View Full Version : vfw codec configuration dialogs in delphi
Sirber
22nd August 2004, 18:00
Hi
I'm trying to load the XviD VFW interface, but ShellExecute fails. Is there another way to start it?
ShellExecute(self.WindowHandle,'open','rundll32.exe xvidvfw.dll,Configure',nil,nil, SW_SHOWNORMAL);
Sirber
22nd August 2004, 18:05
WinExec('rundll32.exe xvidvfw.dll,Configure', SW_SHOW);
this seems to work well. shame delphi don't handle it by itself...
Pyscrow
22nd August 2004, 21:34
Shellexecute is getting pretty long in the tooth, have you tried "createProcess"?
Sirber
22nd August 2004, 21:56
Not yet, I mean, not for this case since CreateProcess is long to code (or copy / paste). Is there a non-API way to execute things?
gircobain
22nd August 2004, 22:02
This works:
ShellExecute(Self.WindowHandle, 'open', 'rundll32.exe', 'xvidvfw.dll,Configure', nil, SW_SHOWNORMAL);
Sirber
22nd August 2004, 22:41
oh, thanks :)
I tryed to mux rundll32 and it's cmdline options :rolleyes:
DaveEL
23rd August 2004, 10:14
not got delphi installed to check this out but this should work
var
XvidDLL: Thandle;
XvidConfigure: procedure (); stdcall;
....
XvidDLL := LoadLibrary('xvidvfw.dll');
XvidConfigure := GetProcAddress(XvidDLL, 'Configure');
XVidConfigure();
FreeLibrary(XvidDLL);
DaveEL
Sirber
23rd August 2004, 12:16
Cool!
It works :D
Do you think I could do something similar for VP6?
DaveEL
23rd August 2004, 13:18
Been looking but it seems (from inital look with strings) that it has no exported method for doing this. Will have to use the standard DriverProc method give me a while and ill try and work out the params.
DaveEL
DaveEL
23rd August 2004, 14:02
try
var
Vp6DLL: Thandle;
Vp6Configure: procedure ; stdcall;
....
Vp6DLL := LoadLibrary('vp6vfw.dll');
Vp6Configure := GetProcAddress(Vp6DLL, 'DriverProc');
Vp6Configure (nil,nil,20490,nil,nil);
FreeLibrary(Vp6DLL);
It might work of course it might crash too :) give me a shout and ill try and fill in all the nils if vp6 doesn't like it.
DaveEL
Sirber
23rd August 2004, 14:39
Thanks! I will try when I get home.
XVidConfigure for VP6? ;)
DaveEL
23rd August 2004, 15:42
Originally posted by Sirber
Thanks! I will try when I get home.
XVidConfigure for VP6? ;)
Fixed
DaveEL
Sirber
23rd August 2004, 18:22
VP6 has 3 FOURCC for the 3 versions. How can I choose the right one with that DLL call?
DaveEL
23rd August 2004, 22:35
Ok bit of a guess at this stage (ive got no compilers installed currently, oh and im drunk) but the the second param should be the fourcc (youll need to jump through a few hoops to put the bytes in an int in delphi but its not too hard). The third param should be as is, param four should be the handle of the "parent window" (TForm.Handle iirc) and 5 is unused i believe. the first one has some meaning which so far ive not worked out but ill get it in the end.
Ill try to keep on efnet #doom9 if you need some more help come and ask.
DaveEL
Sirber
23rd August 2004, 23:50
Delphi tells me there is too much parameters. It only want to runb with no parameters, then it crash when I try :(
Crash:
Vp6DLL: Thandle;
Vp6Configure: procedure (); stdcall;
...
Vp6DLL := LoadLibrary('vp6vfw.dll');
Vp6Configure := GetProcAddress(Vp6DLL, 'DriverProc');
Vp6Configure ();
FreeLibrary(Vp6DLL);
Don't compile:
Vp6DLL: Thandle;
Vp6Configure: procedure (); stdcall;
...
Vp6DLL := LoadLibrary('vp6vfw.dll');
Vp6Configure := GetProcAddress(Vp6DLL, 'DriverProc');
Vp6Configure (nil,nil,20490,nil,nil);
FreeLibrary(Vp6DLL);
[edit]
On MSDN, the params are like this:
LONG DriverProc(
DWORD dwDriverId,
HDRVR hdrvr,
UINT msg,
LONG lParam1,
LONG lParam2
);
[edit2]
I think it'S missing some parameters in Vp6Configure: procedure (); stdcall;
Sirber
24th August 2004, 01:49
I tryed with that:
Vp6Configure: procedure (dwDriverId: word; hdrvr: Cardinal; msg: integer; lParam1: Longword; lParam2: Longword); stdcall;
Getting access violation:
Vp6Configure (0, 0, 20490, 0, 0);
DaveEL
24th August 2004, 10:49
Originally posted by DaveEL
Ill try to keep on efnet #doom9 if you need some more help come and ask.
Missed you was sleeping at the time
Might be simpler to switch to vfw rather then call the dlls directly.
DaveEL
DaveEL
24th August 2004, 11:02
The JEDI vcl components includes a good vfw.pas that ive used before.
jvcl.sf.net
var ICHandle :HIC
...
ICHandle := ICOpen(ICTYPE_VIDEO,mmioFOURCC('V','P','6','0'), ICMODE_QUERY);
if ICQueryConfigure(ICHandle) then
if ICConfigure(ICHandle, Form.handle) = ICERR_OK then
begin
Suff to do if it works
end
else
begin
stuff to do if it fails
end
ICClose(ICHandle)
This should work with all codecs too.
DaveEL
Sirber
24th August 2004, 12:41
Cool! Will try when I get home :D Thx!!!
Sirber
24th August 2004, 13:07
I missed the bus, so I tryed:
ICHandle := ICOpen(ICTYPE_VIDEO,mmioFOURCC('V','P','6','2'), ICMODE_QUERY);
ICQueryConfigure(ICHandle);
ICClose(ICHandle);
The popup was called 2 times, by the two if. This code bellow works perfectly :D
Needed VFW.pas and OLE2.pas.
Gonna add you to my big thanks list :D
DaveEL
24th August 2004, 13:21
var ICHandle :HIC
...
ICHandle := ICOpen(ICTYPE_VIDEO,mmioFOURCC('V','P','6','0'), ICMODE_QUERY);
If ICHandle != 0 then
begin
if ICConfigure(ICHandle, -1) = ICERR_OK then
if ICConfigure(ICHandle, Form.handle) = ICERR_OK then
begin
{Suff to do if it works}
end
else
begin
{stuff to do if it fails}
end
ICClose(ICHandle)
end
else
{Codec failed to load}
Try the above should work ICQueryConfigure should not have the effect you mention i guess this is a bug in the jvcl?
Yep just checked the jvcl and they send 1 not -1 as in my code above guess i better send them a patch
DaveEL
DaveEL
24th August 2004, 13:28
Originally posted by Sirber
This code bellow works perfectly :D
Your code works perfectly in the perfect situation my code will now hopefully work given ive bypassed the jvcl bug and will handle codecs not being installed not having config dialog boxes etc.
DaveEL
Sirber
24th August 2004, 14:34
I will install XviD and VP6 VFW with RealAnime. Both have config dialog.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.