Can AutoHotkey.dll include a function for external calls?
Posted: 15 Oct 2021, 06:39
I am moving to AHK V2
But there are many LIBs that are based on V1
I want AutoHotkey.dll to include a LIB
and then in V2 DllCall to pass in the parameters and get the return value
For example, a lib file called test.ahk contains something like this
Then call it like this in V2
I don't know much about AutoHotkey.dll, is there a way to implement such a function and the correct way to do it?
But there are many LIBs that are based on V1
I want AutoHotkey.dll to include a LIB
and then in V2 DllCall to pass in the parameters and get the return value
For example, a lib file called test.ahk contains something like this
Code: Select all
test(v1, v2)
{
if v1 + v2 = 3
Return test2()
Else
Return 0
}
test2()
{
Return 1 + 2
}
Then call it like this in V2
I don't know much about AutoHotkey.dll, is there a way to implement such a function and the correct way to do it?
Code: Select all
hThread := DllCall("LoadLibrary","Str","AutoHotkey.dll")
MsgBox AHKV2(1, 2)
AHKV2(v1, v2)
{
DllCall("AutoHotkey.dll\ahktextdll", "Str", "#Persistent", "Str", "", "Str", "")
DllCall("AutoHotkey.dll\ahktextdll", "Str", "#Include test.ahk", "Str", "", "Str", "")
DllCall("AutoHotkey.dll\ahkExec", "Str", "result := test(" v1 "," v2 ")")
return DllCall("AutoHotkey\ahkgetvar", "Str", "result", "UInt", 0, "CDecl Str")
}