Build in function to load a dll multiple times from Resource. (For compiled scripts only)
Based on http://www.joachim-bauch.de/tutorials/load_dll_memory.html
hLibrary:=ResourceLoadLibrary(FilePath)
| Parameter | Description |
| FilePath | A path to a file that was included via FileInstall,FilePath,.... |
This handle can be used to get process address of exported functions for this dll (MemoryGetProcAddress).
AutoHotkey.dll, ahkdll, ahktextdll, ahkReady, addFile, addScript, ahkExec, ahkLabel, ahkFunction, ahkPostFunction, ahkassign, ahkgetvar, ahkTerminate, ahkReload, ahkFindFunc, ahkFindLabel, ahkPause, ahkExecuteLine, Alias, cacheEnable, FindFunc, FindLabel, getTokenValue, getVar, Static, AutoHotkeyMini, DynaCall, CriticalSection, CriticalObject, MemoryLoadLibrary, MemoryGetProcAddress, MemoryFreeLibrary, Other Changes
SetWorkingDir % A_ScriptDir ResourceLoadLibrary:="ResourceLoadLibrary" ;call it dynamically as it works in compiled script only If 0 FileInstall,AutoHotkey.dll,AutoHotkey.dll MsgBox % memdll:=A_IsCompiled ? %ResourceLoadLibrary%("AutoHotkey.dll") : MemoryLoadLibrary("AutoHotkey.dll") MsgBox % ahktextdll:=MemoryGetProcAddress(memdll,"ahktextdll") MsgBox % ahkTerminate:=MemoryGetProcAddress(memdll,"ahkTerminate") ; Call exported function DllCall(ahktextdll,"Str","MsgBox","Str","","Str","","Cdecl UInt") MsgBox Thread running DllCall(ahkTerminate,"Int",0) ; Free Library from Memory MemoryFreeLibrary(dll) MsgBox end