ahkdll is used to launch a file containing AutoHotkey script in a separate thread using AutoHotkey.dll. ( Available in AutoHotkey[Mini].dll only, not in AutoHotkey_H.exe)
hThread:=DllCall(dll_path "\ahkdll","Str","MyScript.ahk","Str",options,"Str",parameters,"Cdecl UPTR")
| Parameter | Description |
| hThread | ahkdll() returns a thread handle. |
| "MyScript.ahk" | This parameter must be an existing ahk file. |
| options | Within the script you can access this parameter via build in variable A_ScriptOptions. |
| (parameters) | Parameters passed to dll. Similar to Run myscript.exe "parameters" |
Don't forget to load AutoHotkey.dll via DllCall("LoadLibrary"...), otherwise it will be automatically Freed by AutoHotkey.exe after DllCall finished.
AutoHotkey.dll, 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, ResourceLoadLibrary, MemoryGetProcAddress, MemoryFreeLibrary, Other Changes
AhkDll:=A_ScriptDir "\AutoHotkey.dll"
hModule:=DllCall("LoadLibrary","Str",AhkDll)
DllCall(AhkDll "\ahkdll","Str","MyScript.ahk","Str","","Str","","Cdecl Uint")
MsgBox end main thread
DllCall("FreeLibrary","UInt",hModule)