> ahkTerminate

ahkTerminate

Exported function that exits script currently executed by AutoHotkey module.
This function is only available in AutoHotkey.dll


OutputVar := DllCall("AutoHotkey.dll\ahkTerminate", "Int", Timeout, "Int")
Function Example: DllCall("AutoHotkey.dll\ahkTerminate", "Int", 500, "Int")

Parameters

OutputVar

The name of the variable to store always 0 / false so can be ignored.

Timeout

Time to wait until thread exits, use FALSE / NULL / 0 = no Timeout. NOTE: using a negative vaue you can force exit after given Timeout, with a positive Timeout it might take longer to exit thread but assures a clean exit.

Related

ahkPostFunction, ahkFindFunc

Examples

dllpath:=A_AhkDir "\AutoHotkey.dll"
DllCall("LoadLibrary","Str",dllpath) ; Load the AutoHotkey module.
DllCall(dllpath "\ahktextdll","Str","MsgBox","Str","","Str","","CDecl") ; start a new thread.
Sleep 1000
DllCall(dllpath "\ahkTerminate","UInt",0,"CDecl") ; terminate thread.
MsgBox End

; Same example like above using included AutoHotkey.dll
dll:=AhkThread("MsgBox")
Sleep 1000
dll.ahkterminate[]
MsgBox End