Send mouseclick without activating window?
Send mouseclick without activating window?
Is it possible to send a mouseclick to a window without activating it?
I've had success using PostMessage_() and or SendMessage() with any one of the following:
#WM_LBUTTONDOWN
#WM_LBUTTONUP
#WM_COMMAND/#BN_CLICK
#BM_CLICK
As for the not activating part of it... well so far I can only manage to get that to work after the initial click.
***Edit*** Now that I take a closer look, ignore my last sentence. The window does not activate when I send the button click.
#WM_LBUTTONDOWN
#WM_LBUTTONUP
#WM_COMMAND/#BN_CLICK
#BM_CLICK
As for the not activating part of it... well so far I can only manage to get that to work after the initial click.

***Edit*** Now that I take a closer look, ignore my last sentence. The window does not activate when I send the button click.
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
Where's your sense of adventure...your curiosity...how can you ignore that challenge...you gonna let that whimpy little button get the best of youMistrel wrote:I still can't get it to click but it's not important anymore.

Send it over here and I'll show it what these 8 fingers and 2 opposable thumbs can do

jk...

Glad to see you found a workaround for this Mistrel.

What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1
Ok, Sparkie I'll give it to you. 
Download AC Tool and use this script:
Your objective is to figure out how to send a mouseclick to the "Start" button control. And no cheating by hard-coding an off-set from the bottom-right corner of the screen.
I couldn't figure out how to send a message to this control to simulate a mouse button. The "Start" button doesn't appear to be a real button. You can confirm this with a tool like Winspector.
The correct way to do it is to have the script loop as quickly as you want and check for keyboard events that way. So, start the script once and loop it instead of each time you want it to do something.
Don't fail me in this mission, snake!

Download AC Tool and use this script:
Code: Select all
bell
I couldn't figure out how to send a message to this control to simulate a mouse button. The "Start" button doesn't appear to be a real button. You can confirm this with a tool like Winspector.
The correct way to do it is to have the script loop as quickly as you want and check for keyboard events that way. So, start the script once and loop it instead of each time you want it to do something.
Don't fail me in this mission, snake!
Code: Select all
Macro MakeLong(low, high)
low | high <<16
EndMacro
hParent = FindWindow_("TfrmMain", 0)
If hParent
hChild1 = FindWindowEx_(hParent, 0, "TPageControl", 0)
If hChild1
hChild2 = FindWindowEx_(hChild1, 0, "TTabSheet", "Commands and Macros")
If hChild2
hChild3 = FindWindowEx_(hChild2, 0, "TPanel", 0)
If hChild3
hChild4 = FindWindowEx_(hChild3, 0, "TPanel", 0)
If hChild4
hChild5 = FindWindowEx_(hChild4, 0, "TPanel", 0)
If hChild5
pause = 1000
For bell = 1 To 5
SendMessage_(hChild5, #WM_LBUTTONDOWN, 0, MakeLong(10, 60))
Delay(100)
SendMessage_(hChild5, #WM_LBUTTONUP, 0, MakeLong(10, 60))
Delay(pause)
Next
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
Last edited by Sparkie on Wed Aug 27, 2008 9:51 pm, edited 1 time in total.
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1