First time trying out AutoHotKey_H v1 to see if the Multi-Threading will help my script. Reading the docs it seems pretty simple to use ObjShare() to be able to access my class method from the thread started with AhkThread().
I have been trying everything I can think of for hours now and I can't even get the example form the docs https://hotkeyit.github.io/v2/docs/commands/ObjShare.htm#Examples to work.
All I ever get is an error LResult Object could not be created
I have installed _H correctly as far as I can tell as other examples from the docs run fine. Is there any issue with ObjShare() command that anyone else has expirenced? Can someone verify that the example works, and if so what could i possible be missing?
Thanks
ObjShare() example Topic is solved
Re: ObjShare() example Topic is solved
The example was for an older AHK_H v2, here for v1, just changed to ObjShare(" lresult "):
Code: Select all
Gui,Add,Slider,vSlider,50
Gui,Add,CheckBox
Gui,Show,w200 h100
t:=new Test
lresult := ObjShare(t) ; Create lresult to use in a different thread
AhkThread("
(
t := ObjShare(" lresult ") ; Create IDispatch proxy COM object
Loop
t.CheckBox()
)")
Loop
t.Slider()
return
GuiClose:
ExitApp
Class Test {
CheckBox(){
GuiControlGet,value,,Button1
GuiControl,,Button1,% Value?0:1
}
Slider(){
GuiControlGet,value,,Slider
if value=100
value:=0
GuiControl,,Slider,% Value+1
}
}
Re: ObjShare() example
Thanks HotKeyIt, I did not realize that syntax was different.
I can't seem to find reference to that in the docs...is that just for _H specific functions called from within AhkThread()?
I can't seem to find reference to that in the docs...is that just for _H specific functions called from within AhkThread()?
Who is online
Users browsing this forum: No registered users and 30 guests