I currently use the following function to register a dll that handles context menu calls.
function RegisterLibrary(szLibrary: String): Integer;
var
hLib: THandle;
drs: TDllRegisterServer;
begin
// Attempt to load the library
hLib := LoadLibrary(PChar(szLibrary));
// Handle check
if IsHandle(hLib) then
begin // Get the register function
@drs := GetProcAddress(hLib, LIB_REGISTER);
if Assigned(@drs)
then Result := drs // Make the function call
else Result := GetLastError; // Return last error
// Unload the library
FreeLibrary(hLib);
end else
Result := GetLastError; // Return last error
end;
Unfortunately it doesn't work when trying to register a 64-bit dll from my 32-bit application.
Is there any alternative to register my 64-bit dll (compiled with free pascal) from my 32-bit application (compiled in Delphi)?
I suppose I can call C:\Windows\system\regsvr32.exe" /s "filename" but would like to know if I have any other alternative.
Thanks!