ThreadObj() Not Found

Ask for help, how to use AHK_H, etc.
1100++
Posts: 78
Joined: 10 Feb 2018, 19:05

ThreadObj() Not Found

Post by 1100++ » 22 Jul 2020, 00:00

I'm trying to use the ThreadObj() function to monitor when I press the RWin key and retrieve the timestamps created. However, when I try to run a script that uses the function, I get a message saying that it doesn't exist. Here's my code:

Code: Select all

MonitorRWin := ThreadObj("Loop {`nKeyWait RWin, D`nDllCall(""QueryPerformanceCounter"", ""Int64*"", RWinP)`nKeyWait RWin`n} return")
Does anyone know what I need to do to resolve this?

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: ThreadObj() Not Found

Post by HotKeyIt » 23 Jul 2020, 08:05

ThreadObj exists only in v2, simply use AhkThread:

Code: Select all

MonitorRWin := Ahkthread("RWin:=0`nLoop {`nKeyWait RWin, D`nQueryPerformanceCounter(getvar(RWinP1:=0))`nKeyWait RWin`nQueryPerformanceCounter(getvar(RWinP2:=0))`nRWin:=RWinP2-RWinP1`n} return")
Alias(RWin,MonitorRWin.ahkgetvar("RWin",1))
Loop {
	ToolTip % RWin
}
Esc::ExitApp

Post Reply

Return to “Ask for Help”