delphi中实现dll文件自动注册
type
TDllRegisterServer=function:HResult; stdcall;
procedure RegisterDll(DllName :string);
var
h:HModule;
Ocx:TDllRegisterServer;
begin
h := 0;
try
h := LoadLibrary(PChar(DllName));
@Ocx:=GetProcAddress(H,'DllRegisterServer');
Ocx;
except
ShowWarning('注册' + DllName + '失败!请检查该文件是否存在。');
end;
FreeLibrary(H);
end;