HotKeyIt wrote:Try
ObjShare then, you can get the ahk code from
here.
Thanks. This was helpful.
I managed to assemble this minimal working example in AHK_L v2:
Code: Select all
#persistent
LresultFromObject(obj){
static IDispatch
, set := VarSetCapacity(IDispatch, 16)
, init := NumPut(0x46000000000000c0, NumPut(0x20400, IDispatch, "int64"), "int64")
return DllCall('Oleacc.dll\LresultFromObject', ptr,&IDispatch, ptr,0, ptr,&obj, ptr)
}
class Test{
Call(msg){
tooltip % msg
}
}
obj := new Test
lresult := LresultFromObject(obj)
threadCode := "
(
ObjectFromLresult(lresult){
static IDispatch
, set := VarSetCapacity(IDispatch, 16)
, init := NumPut(0x46000000000000c0, NumPut(0x20400, IDispatch, "int64"), "int64")
if DllCall('Oleacc.dll\ObjectFromLresult', ptr,lresult, ptr,&IDispatch, ptr,0, ptr,getvar(com:=0))
throw "LResult Object could not be created"
return ComObject(9,com,1)
}
obj := ObjectFromLresult(%lresult%)
loop 5 {
obj.call(A_index ' Hi' )
sleep 1000
}
)"
ahkDll := "AutoHotkey.dll"
DllCall("LoadLibrary", str,ahkDll)
DllCall(ahkDll '\ahktextdll', str,threadCode, str,'', 'CDecl')
But I don't know if this is how it should be done.
Your code on Github calls those DLL functions like they were AHK functions.
I did a search on the repository but there's no mention of
ObjectFromLresult or
LresultFromObject.
Also, I was surprised to find out that the function
ObjShare does not exist in AHK.dll, but only in AHK_H, so I had to implement the 'ObjectFromLresult' part inside the thread code.
Anyways, I'm happy to have this working, but still kind of confused by your code on Github.