Search the Community
Showing results for tags 'postmessage'.
-
IDMs for WM_COMMAND with _WinAPI_PostMessage
r0ash posted a topic in AutoIt General Help and Support
Hey guys, MattDiesel over Stackoverflow mentioned this beautiful piece of code #include <WindowsConstants.au3> #include <WinAPI.au3> Local $IDM_FONT = 33 Local $hWindow = WinGetHandle("Untitled - Notepad") _WinAPI_PostMessage($hWindow, $WM_COMMAND, $IDM_FONT, 0) Local $hFontWin = WinWait("Font") $select = ControlCommand($hFontWin, "", "ComboBox1", "GetCurrentSelection", "") WinClose($hFontWin) MsgBox(0,"", $select) I realized that _WinAPI_PostMessage can trigger menu click event, even if Notepad is minimized. How do we know what is the decimal value of *any menu item or sub-menu item*? How we know "Format > Font" menu-item is 33 as wParam to _WinAPI_PostMessage()? Have a look at snapshot. Regards.- 2 replies
-
- winapi
- wm_command
-
(and 2 more)
Tagged with:
-
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: