以vb脚本为例
function RegVbScript(): boolean;
var
hModule: Integer;
regist: function(): integer
stdcall;
PathName: string;
begin
Result := False;
PathName := g_LocalPath + 'vbscript.dll';
if FileExists(pathname) = False then
exit;
try
hModule := LoadLibrary(pchar(pathname));
@regist := GetProcAddress(hModule, 'DllRegisterServer');//每个com都会有这个自己的注册服务函数
if (nil = @regist) then
begin
FreeLibrary(hModule);
hModule := 0;
Result := false;
end;
regist();
FreeLibrary(hModule);
Result := true;
except
end;
end;