Zitat von
Dezipaitor:
Das geht relativ einfach.
Ich fürchte aber, das da das
UAC Monster auf der Lauer liegt.
type
TDLLRegisterServer = function
WORD;
TDLLUnregisterServer = function
WORD;
function RegisterServer(const Filename: String): Boolean;
var
hLib: THandle;
ProcAddress: TDLLRegisterServer;
begin
Result := False;
hLib := LoadLibrary(PChar(Filename));
if hLib <> 0 then
begin
@ProcAddress := GetProcAddress(hLib, 'DllRegisterServer');
if Assigned(ProcAddress) then
begin
Result := ProcAddress = S_OK;
end
end
end;
function UnregisterServer(const Filename: String): Boolean;
var
hLib: THandle;
ProcAddress: TDLLUnregisterServer;
begin
Result := False;
hLib := LoadLibrary(PChar(Filename));
if hLib <> 0 then
begin
@ProcAddress := GetProcAddress(hLib, 'DllUnregisterServer');
if Assigned(ProcAddress) then
begin
Result := ProcAddress = S_OK;
end
end
end;