Sign in to follow this  
Followers 0
Brestell

ControlClick, inactive window

3 posts in this topic

I've been trying to send a mouse click to an inactive window, with ControlClick, but I can only get it to work when the window is active.

Then I tried using ControlClick with AutoHotkey and it worked

#n::ControlClick, x400 y200, WinTitle; This works with inactive window.
#n::ControlClick,, WinTitle,,,, NA x400 y200 ; This does NOT work with inactive window.

Then I tried again using ControlClick in Autoit, and this time it worked all of a sudden.

$handle = WinGetHandle( "WinTitle" )
ControlClick($handle,"","","",1,400,200)

However, after a while AutoIt didn't work with the inactive window anymore.

Later I found that it works if I do this:

*Let the the window be inactive and use AutoHotkey to send a mouse click

*Now the AutoIt Script will work, as long as I don't activate the window. If I do, AutoIt won't work if I inactivate the window again.

I've tried analyzing the source code of AutoHotKey to see why it works but AutoIt doesn't, but I haven't solved it. I see that AutoHotkey is using SetActiveWindow(), but the window actually never becomes active, its still in the background. But if I use AutoHotkey on any other software like Firefox, then it brings the Firefox window to the foreground. Also, AutoIt ControlClick does work on Firefox when its inactive. So it seems like it's the specific program that is wierd and not responding as it's supposed to. Any thoughts?

I've also tried PostMessage, and SendMessage, but it doesn't work when the window is inactive.

Share this post


Link to post
Share on other sites



Hi, Brestell. So I think it begs the question, what program are you trying to manipulate? I agree that it sounds like it is specific to the program window, but without knowing the app, we're shooting in the dark :)


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Brestell,

Reposting the same question, but removing the "game" words does not work. If you read those rule to which I linked you, there is a bit which says:

"Do not create a new topic on a subject if a previous topic on that subject was locked"

Please read those rules carefully before you post again. :naughty:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0