[AHK_H v2] OpenThread() error 126 module not found Topic is solved

Ask for help, how to use AHK_H, etc.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

[AHK_H v2] OpenThread() error 126 module not found

27 Jan 2019, 11:51

i want to start a thread and call OpenThread() on it, but im getting this error message. why?

Code: Select all

Thread := AhkThread("#Persistent`nLoop`nToolTip(A_TickCount)")
dwThreadId := Thread.AhkGetVar.A_ThreadID

THREAD_QUERY_INFO := 0x0040
bInherited := false

; hThread := OpenThread(THREAD_QUERY_INFO, bInherited, dwThreadId)
hThread := DllCall("kernel32.dll\OpenThread", "UInt", THREAD_QUERY_INFO, "Int", bInherited, "UInt", dwThreadId, "Ptr")
MsgBox Clipboard := Format("
(
	ErrLvl: {}
	LastErr: {}
	Msg: {}
)", ErrorLevel, A_LastError, ErrorMessage(A_LastError))

/*
ErrLvl: 0
LastErr: 126
Msg: The specified module could not be found. 
*/
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [AHK_H v2] OpenThread() error 126 module not found  Topic is solved

27 Jan 2019, 12:16

Don't bother about last error it comes from somwhere else, check if hThread is NULL, then check last error!

Code: Select all

Thread := AhkThread("#Persistent`nGetThreadId`nLoop`nToolTip(A_TickCount)")

THREAD_QUERY_INFO := 0x0040
bInherited := false
if NULL = hThread := OpenThread(THREAD_QUERY_INFO, bInherited,  Thread.AhkGetVar.A_ThreadID)
MsgBox Clipboard := Format("
(
	ErrLvl: {}
	LastErr: {}
	Msg: {}
)", ErrorLevel, A_LastError, ErrorMessage(A_LastError))
MsgBox hThread

Return to “Ask for Help”

Who is online

Users browsing this forum: No registered users and 43 guests