Jump to content

Recommended Posts

Posted (edited)

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
Posted (edited)

Thanks a bunch @junkew

I am using Spy++ tool for the first time, I am unable to log messages, watch, do you think I am missing something? 

Unable to display content. Adobe Flash is required.

 

Edited by r0ash

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
×
×
  • Create New...