OnMessage Question

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

OnMessage Question

27 May 2018, 16:09

Can I use onmessage to monitor messages sent to another program?

Say I have a program called program.exe and I want to monitor to see when a specific message is sent to that program, is that possible without messing up program.exe?
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: OnMessage Question

27 May 2018, 20:49

This is regarding your question whether a compiled script's Control command can be captured by another compiled script correct?
If so, yes a compiled script can capture a Windows Message from another script. However, not all Control commands send Windows Messages.

For instance, your receiving script can capture ControlSend to an embedded control structured like:
Receiving Script:

Code: Select all

WM_COMMAND = 0x111 ; Windows Message 

OnMessage( WM_COMMAND, "MessageFunc" )
Gui, Add, Button,, Test
Gui, Show, w300 h300, Receiving Script
Return

MessageFunc()
{
	ToolTip Test Control Clicked
}

GuiClose:
ExitApp
Sending Script:

Code: Select all

F1::ControlSend, Button1, {Enter}, Receiving Script
Esc::ExitApp ; Press Escape To Exit
Using a Windows message spy will reveal a given message being received if any.
Note: To test my structure in the way you were originally asking, obviously you have to compile at least the receiving script ;)
htms

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], RandomBoy and 253 guests