老大,Com Server的dll要输出下面四个函数供程序调用,你看看这四个函数中都要调用
类工厂和comserv,它如果不在intialize部分创建类工厂的实例的话,这四个函数根本就
是摆设,屁用都没有啊!!!
function DllRegisterServer: HResult;
begin
Result := S_OK;
try
MyFactory.UpdateRegistry(True);
except
Result := E_FAIL;
end;
end;
function DllUnregisterServer: HResult;
begin
Result := S_OK;
try
MyFactory.UpdateRegistry(False);
except
Result := E_FAIL;
end;
end;
function DllGetClassObject(const CLSID, IID: TGUID; var Obj): HResult;
begin
Result := ComServ.DllGetClassObject(CLSID, IID, Obj);
end;
function DllCanUnloadNow: HResult;
begin
Result := ComServ.DllCanUnloadNow;
end;
initialization
MyFactory := TOLETestImpFactory.Create(ComServer,TOLETestImp,ClassGUID,'OLEInserter1','Delphi *.ols File Inserter',ciInternal);
end.