Search the Community
Showing results for tags 'message queue'.
-
Hi guys, I need to send a message (WM_APP message) to my thread and return immediatly, I tried to do it using PostMessage (a no-blocking function) with hWnd param = Null (it posts the message to the thread message queue). I tried to get the message from the queue using PeekMessage (another function that returns immediatly) but it can't try the message. I'm able to post and retrieve a message from a window message queue (using GUIRegisterMsg, it would be useful to know its source code) but it would be better if I could use the thread message queue. I really don't understand why PeekMessage doesn't retrieve the message posted. $iMsg = 0x8000 $tagPOINT = "struct; long x; long y; endstruct" $tagMSG = "hwnd Hwnd;uint message;wparam wParam;lparam lParam;dword time;" & $tagPOINT $tMSG = DllStructCreate($tagMSG) $pMSG = DllStructGetPtr($tMSG) $hwnd = GUICreate("GUI") $aResult = DllCall("user32.dll", "bool", "PostMessage", "hwnd", Null, "uint", $iMsg, "wparam", "some", "lparam", "thing") ;$aResult[0] = 1 -----> the message is posted to the thread message queue $aResult = DllCall("user32.dll", "bool", "PeekMessage", "ptr", $pMSG, "hwnd", Null, "uint", $iMsg, "uint", $iMsg, "uint", 1) ;@error = 0 -----> DllCall doesn't fail ;$aResult[0] = 0 ----> PeekMessage doesn't retrieve the message If $aResult[0] <> 0 Then ConsoleWrite(DllStructGetData($tMSG, "wParam") & @CRLF) Exit Else For $i = 1 To 4 Beep(800, 250) Next EndIf
- 2 replies
-
- message queue
- peekmessage
-
(and 1 more)
Tagged with: