Launch Function & Catch Object in DllThread
Posted: 15 Jul 2019, 05:51
A fellow member has infected me with AutoHotkey_H. Ironically it's me trying to help him.
I can launch function from dllThread and catch its value if the function returns number or string.
If the function returns object I'm lost.
For the reason of saving my time, Thanks for any hint!
I can launch function from dllThread and catch its value if the function returns number or string.
If the function returns object I'm lost.
Code: Select all
;MsgBox % "Main Var:`n" var(3, 5) ; works
;for i, j in obj(0, 1) ; works
;MsgBox % "Main Obj:`n" i ": " j
test := "
(
test := AhkExported()
;MsgBox `% ""test Var:``n"" test.ahkFunction(""var"", 3 """", 5 """") ; \/ (works for numbers & strings, but not for objects)
;CritObj := CriticalObject({""answer"": 0, ""on"": 1}) ; \/ (works, but need to call 'ahkFuntion()'!)
;init:=test.ahkFunciton(""add"", 0 """", 1 """") ; ?????????????
;CritObj := CriticalObject(init) ; ??????????????
CritObj := CriticalObject( test.ahkFunction(""obj"", 0 """", 1 """") ) ; //// (desn't work!!!)
for i, j in CritObj
MsgBox `% ""test Obj:``n"" i "": "" j
)"
AhkDll := AhkThread(test, &CritObj)
While AhkDll.ahkReady()
Sleep 100
SoundBeep, 8000
ExitApp
return
obj(a, b) {
;return StrSplit(a "," b, ",")
return {"answer": a, "on": b}
}
var(a, b) {
Return a+b
}