-
Notifications
You must be signed in to change notification settings - Fork 71
/
AhkDllObject.ahk
43 lines (43 loc) · 1.05 KB
/
AhkDllObject.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
AhkDllObject(dll="AutoHotkey.dll",obj=0){
static
static functions ="
(Join
ahkKey:s|ahkFunction:s=sssssssssss|ahkPostFunction:s=sssssssssss|
ahkdll:ui=sss|ahktextdll:ui=sss|ahkReady:|ahkReload:ui=|
ahkTerminate:i|addFile:ui=sucuc|addScript:ui=sucuc|ahkExec:ui=s|
ahkassign:ui=ss|ahkExecuteLine:ui=uiuiui|ahkFindFunc:ui=s|
ahkFindLabel:ui=s|ahkgetvar:s=sui|ahkLabel:ui=sui|ahkPause:s
)"
If !(dll){
Loop % i
{
idx:=A_Index
Loop,Parse,functions,|
DynaCall(dll%idx% . "\" . A_LoopField)
DllCall(dll%A_Index% . "\ahkTerminate")
DllCall("FreeLibrary","UInt",dllmodule%A_Index%)
obj%A_Index%=
dll%A_Index%=
dllmodule%A_Index%=
}
i=0
return
} else {
Loop % i
If (dll=dll%A_Index%)
return obj%A_Index%
}
i++
dllmodule%i%:=DllCall("LoadLibrary","str",dll)
if IsObject(obj)
object:=obj
else
object := Object()
Loop,Parse,functions,|
{
object[f:=SubStr(A_LoopField,1,InStr(A_LoopField,":")-1)] := DynaCall(dll "\" f,SubStr(A_LoopField,InStr(A_LoopField,":")+1))
}
obj%i%:=object
dll%i%:=dll
return obj%i%
}