DllLoad() / DllUnload() ?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2062
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

DllLoad() / DllUnload() ?

Post by AUGE_OHR »

hi,

i can make DLL Call like this

Code: Select all

#xtranslate DllCall              => HMG_CallDLL

   lSuccess := DllCall( "ADVAPI32.DLL", DLL_OSAPI, "RegCloseKey", nKeyHandle )
under Xbase++ i can DllLoad() / DllUnload()

Code: Select all

   IF nDllHandle = 0
      nDllHandle := DllLoad( "ADVAPI32.DLL" )
   ENDIF
   lSuccess := DllCall( nDllHandle, DLL_OSAPI, "RegCloseKey", nKeyHandle )
when have "many" DllCall i can use same Handle
so how can i DllLoad() under harbour :idea:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2062
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: DllLoad() / DllUnload() ?

Post by AUGE_OHR »

hi,

i have try

Code: Select all

FUNCTION DllLoad()
LOCAL nDLL := HMG_CallDLL( "Kernel32.dll",, "LoadLibrary", "ADVAPI32.DLL" )
RETURN nDLL

FUNCTION DllUnload(nDLL)
RETURN FreeLibrary( nDLL )
but it seems not to work ... :(

Code: Select all

   nDllHandle := DllLoad()
   nCallSuccess := DllCall(nDllHandle, DLL_OSAPI, "RegCloseKey", nKeyHandle )
it does work when call DLL "Name" instead of nDllHandle

Code: Select all

   nCallSuccess := DllCall("ADVAPI32.DLL", DLL_OSAPI, "RegCloseKey", nKeyHandle )
hm ... what i´m doing wrong ...
have fun
Jimmy
Post Reply