I am currently using 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, this does not work when trying to register a 64-bit dll from my 32-bit application.
Is there an alternative to registering 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" file name ", but would like to know if I have another alternative.
Thanks!
source
share