Jump to content

IDMs for WM_COMMAND with _WinAPI_PostMessage


Recommended Posts

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.

idm_notepad_font.jpg

Edited by r0ash
typo + tags addition
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...