Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

HotkeyP Spy utility for detecting WM_COMMAND messages


  • Please log in to reply
12 replies to this topic
Diamond
  • Members
  • 198 posts
  • Last active: Dec 02 2015 11:18 AM
  • Joined: 31 Mar 2006
There is a nice little hotkey utility called HotkeyP.


 

 


 


 

 


 

It really can't do much that can't be done better with AutoHotkey, but it includes a useful utility which is simply called Spy.  Spy monitors all Windows for WM_COMMAND messages.  Of course you can do this with Winspector and other similar applications, but with Spy you don't have to select a target Window and it specifically only monitors for WM_COMMAND so there's no scrolling through long lists or having to manually filter extraneous messages.  Also, I found this utility more convenient than Winspector in one other respect.  In some cases, it helps you detect hard to find WM_COMMAND messages more easily.  For example, I was attempting to discover the message for enabling/disabling the IE Pop-up Blocker.  I tried using Winspector to monitor IE's main window.  As it turns out this is not where that particular message needs to be sent so of course Winspector detected nothing.  However, since the Spy utility monitors all windows automatically, it showed that WM_COMMAND 41301 was being sent to the control labeled ITBarHost with class InternetToolbarHost.  So,


 

 


 

PostMessage 273, 41301, 0, ITBarHost


 

 


 

or


 

 


 

PostMessage 273, 41301, 0, InternetToolbarHost1


 

 


 

works.


UppyDan
  • Members
  • 33 posts
  • Last active: Oct 08 2015 03:49 AM
  • Joined: 19 Feb 2013
Awesome! Thanks for bringing this to our attention, Diamond. As you said, the HotkeyP application isn't all that exciting, but the SPY.EXE program that comes with it is just what the doctor ordered. I spent 2 days trying to find the WM_COMMAND message from an application using SPY++ and everything else I could think off. I ran this little tool and presto, it gave me the WM_COMMAND ID on the first try, and the ID actually worked when I put in my AHK script. Love it.

Visioneer
  • Members
  • 287 posts
  • Last active: Sep 17 2017 10:07 PM
  • Joined: 19 Nov 2007

Fantastic Diamond,

 

It does turn off the blocker, but I don't see it turning it back on. I tried it after a WinWaitClose.

Spy shows the same thing when I turn on, or turn off, the blocker.

 

Also, may I ask where you got the 273 parameter from?

Could that need to be changed to make it turn on?

 

Thanks



Diamond
  • Members
  • 198 posts
  • Last active: Dec 02 2015 11:18 AM
  • Joined: 31 Mar 2006
Hello Visioneer,
 
I'm not quite sure why it isn't working for you as a toggle.  Like you said, the message is the same for both disabling and enabling as shown by Spy.  When you say you tried it after WinWaitClose, do you mean that you waited until the IE window was closed to send the message?  If so, this will not work.  IE has to be running to receive the message.
 
273 is the WM_COMMAND message so it should not be changed.


Visioneer
  • Members
  • 287 posts
  • Last active: Sep 17 2017 10:07 PM
  • Joined: 19 Nov 2007

Thanks Diamond.

 

Very helpful.



kcomplex
  • Members
  • 50 posts
  • Last active: Jun 20 2015 09:23 AM
  • Joined: 29 Jul 2010

I use a piece of software called MT4 which i use a lot of WM_command code in. I want to transfer the code to the new version of the software called MT5 which is very similar. I thought this program would make it easier as it works to identify wm_commands on MT4 but for some reason it is not working on MT5! could it be that MT5 has stopped using wm_command messages completely or could there be some other reason window spy is not detecting them? 



Diamond
  • Members
  • 198 posts
  • Last active: Dec 02 2015 11:18 AM
  • Joined: 31 Mar 2006
Since the utility detects WM_COMMAND messages system wide, I suspect that the newer version of your application is probably no longer using WM_COMMAND messages as you say.


UppyDan
  • Members
  • 33 posts
  • Last active: Oct 08 2015 03:49 AM
  • Joined: 19 Feb 2013

Another possibility is MT5 is 64-bit.  Many spy programs only see 32-bit messages.  The only one I've heard about that works for 64-bit messages is part of Microsoft Visual Studio (i.e. not free.)  I looked for a stand-alone spy program, but had no luck.
https://msdn.microso...y/dd460756.aspx



Diamond
  • Members
  • 198 posts
  • Last active: Dec 02 2015 11:18 AM
  • Joined: 31 Mar 2006
I'm not sure that the architecture of an application will affect whether it's WM_COMMAND messages are detected.  The HotkeyP Spy utility has no problems detecting WM_COMMAND messages generated by the 64 bit version of Internet Explorer.


UppyDan
  • Members
  • 33 posts
  • Last active: Oct 08 2015 03:49 AM
  • Joined: 19 Feb 2013

 

I'm not sure that the architecture of an application will affect whether it's WM_COMMAND messages are detected.  The HotkeyP Spy utility has no problems detecting WM_COMMAND messages generated by the 64 bit version of Internet Explorer.

 

 

Interesting.  When I run HotkeyP's spy.exe (file version 4.3.0.0) on my 64-bit Win 7 PC, it doesn't show any messages from Explorer or Internet Explorer ... not even if I run it as Admin.  :(

Perhaps it has something to do with UAC (User Account Control Settings).  I have mine set one level below "Always Notify".  I might play around with it later.



Diamond
  • Members
  • 198 posts
  • Last active: Dec 02 2015 11:18 AM
  • Joined: 31 Mar 2006

Interesting.  When I run HotkeyP's spy.exe (file version 4.3.0.0) on my 64-bit Win 7 PC, it doesn't show any messages from Explorer or Internet Explorer ... not even if I run it as Admin.  :(

Perhaps it has something to do with UAC (User Account Control Settings).  I have mine set on level below "Always Notify".  I might play around with it later.

 

I can't imagine why,but I suppose it is possible that IE is an exception.  Try turning the popup blocker on/off and se if HotkeyP Spy detects the messages on your system.  I have no idea if it makes a difference, but for the record I have UAC completely disabled.


SOTE
  • Members
  • 53 posts
  • Last active: Jul 06 2015 12:35 PM
  • Joined: 04 Jun 2015

I ran it and it doesn't show anything on my system as well, blank.  Windows 8.1 (64-bit).  Any other similar programs for WM_COMMAND messages?



Diamond
  • Members
  • 198 posts
  • Last active: Dec 02 2015 11:18 AM
  • Joined: 31 Mar 2006

For the record, it seems that the WM_COMMAND message for toggling the state of the Pop-up Blocker no longer works with IE 11.