ahkFindFunc()

Auto Hotkey

ahkFindFunc

Exported function that finds a function in currently executed script and returns a pointer to it.

OutputVar := ahkFindFunc("FuncName")
Function Example: OutputVar := DllCall("AutoHotkey.dll\ahkFindFunc", "Str", "FuncName", "PTR")
                  OutputVar := DllCall("AutoHotkey.exe\ahkFindFunc", "Str", "FuncName", "PTR")

Parameters

OutputVar

The name of the variable to store the function pointer in or 0 if the function was not found.

FuncName

The name of the function to find.

Related

ahkFunction, ahkPostFunction, ahkFindLabel, DllCall

Examples

dllpath:=A_AhkDir "\AutoHotkey.dll"
DllCall("LoadLibrary","Str",dllpath) ; Load the AutoHotkey module.
DllCall(dllpath "\ahktextdll","Str","#Persistent`nMyFunc(param){`nReturn param`n}","Str","","CDecl") ; start a new thread, just the function.
MsgBox % DllCall(dllpath "\ahkFindFunc","Str","MyFunc","CDecl PTR") ; call the function and display pointer in MsgBox.

; Same example like above using included AutoHotkey.dll
dll:=AhkThread("#Persistent`nMyFunc(param){`nReturn param`n}")
MsgBox % dll.ahkFindFunc["MyFunc"]

; Find pointer to function in current thread
MsgBox % ahkFindFunc("NumGet")