如何使用DSPack加载未在delphi 7中的.ax文件注册的DirectShow过滤器? 我发现an example in C++,我不知道如何将其翻译成Delphi。
答案 0 :(得分:3)
function LoadFilter(const Fhandle: HMODULE; clis: TGUID): IBaseFilter; overload;
Var
DllGetClassObject: Function(Const clsid, IID: TGUID; Var Obj)
: HRESULT; STDCALL;
ClassF: IClassFactory;
Begin
result := nil;
try
If Fhandle = 0 Then
exit;
// NOTE: Fhandle is typically obtained as a result of LoadLibrary API
// call loading DLL hosting the DirectShow filter
DllGetClassObject := GetProcAddress(Fhandle, 'DllGetClassObject');
DllGetClassObject(clis, IClassFactory, ClassF);
if assigned(ClassF) then
begin
if ClassF.CreateInstance(nil, IID_IBaseFilter, result) = ERROR_SUCCESS
then
exit;
end;
except
exit;
end;
end;