ahkdll() [AutoHotkey.dll or AutoHotkey_NL30N7+]


launches a script within AutoHotkey.dll

hThread := DllCall("AutoHotkey.dll\ahkdll", "str", fileName, "str", argv, "str", args, "Cdecl Int")

Parameters

hThread ahkdll() returns the handle to the thread in which the dll script runs.
filename name of script to be compiled and added to the running script
argv options, the only one supported is "/Debug" for Lexikos' Debugging Features
args script parameters: "%1% %2% %3%", see ahk help file

Remarks


its ahkdll, not addDll or other variation. case is important for dllcall.
when the client script exits, so does the host app automatically. Use #persistent in the client script, if you want the host app to continue going.

Examples

Host Script

ahkdll := DllCall("LoadLibrary", "str", A_ScriptDir . "\AutoHotkey.dll")
sleep, 500
threadH := DllCall(A_ScriptDir . "\AutoHotkey.dll\ahkdll", "str", "dllclient.ahk", "str"
, "", "str", "parameter1 parameter2", "Cdecl Int") 

Client Script

; dllclient.ahk
#Persistent
msgbox % "script parameters =" . A_ScriptParams . "script options = "
. A_ScriptOptions 
return