ControlClicking on a window hidden by 'winHide'? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Ralf_Reddings200244
Posts: 121
Joined: 11 Mar 2023, 14:16

ControlClicking on a window hidden by 'winHide'?

28 Mar 2024, 14:27

This is not a script issue per se and for that matter is not limited to either V1 or V2 of the language but its something I would like to ask and see if others have had any luck with it

This is something that AutoIt can apparently do, Send ControlClick to Hidden Window?.
My tests with AHK tells me its not possible

Code: Select all

controlClick, 100,10, ahk_exe foobar2000.exe,,,, NA
The above clicks on top left of foobars window (Win32 UI), without activating the window. The following is the same but meant to click on Foobar while it is hidden but upon showing the window, it is evident the button was not clicked:

Code: Select all

DetectHiddenWindows, on
WinHide, ahk_exe foobar2000.exe
sleep, 500
controlClick, 100,10, ahk_exe foobar2000.exe,,,, NA
sleep, 500
winShow, ahk_exe foobar2000.exe
Its my understanding that both AutoIt and AutoHotkey are using the same underlying windows facilities, so I dont understand discrepancy.

Can anyone confirm if they have ever managed to get controlClick to work on hidden windows?
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: ControlClicking on a window hidden by 'winHide'?

28 Mar 2024, 14:48

Don't know the answer - but at least your ControlClick syntax is currently incorrect and your code above can't work as expected:
ControlClick wrote:Mode 1 (Position): Specify the X and Y coordinates relative to the target window's upper left corner. The X coordinate must precede the Y coordinate and there must be at least one space or tab between them. For example: X55 Y33.[...]
Compare example #2:
https://www.autohotkey.com/docs/v1/lib/ControlClick.htm#ExCoord wrote:
Clicks at a set of coordinates. Note the lack of a comma between X and Y.

Code: Select all

ControlClick, x55 y77, Some Window Title
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: ControlClicking on a window hidden by 'winHide'?  Topic is solved

28 Mar 2024, 14:58

This can be found in the ControlClick docs which seems to support that hidden windows are supported in principle:
Parameters: Control-or-Pos wrote:To operate upon a control's HWND (window handle), leave this parameter blank and specify ahk_id %ControlHwnd% for the WinTitle parameter (this also works on hidden controls even when DetectHiddenWindows is Off). The HWND of a control is typically retrieved via ControlGet Hwnd, MouseGetPos, or DllCall().
Parameters: WinTitle, WinText, ExcludeTitle, ExcludeText wrote:By default, hidden windows are not detected and hidden text elements are detected, unless changed with DetectHiddenWindows and DetectHiddenText. By default, a window title must start with the specified WinTitle or ExcludeTitle to be a match, unless changed with SetTitleMatchMode.
Ralf_Reddings200244
Posts: 121
Joined: 11 Mar 2023, 14:16

Re: ControlClicking on a window hidden by 'winHide'?

29 Mar 2024, 14:42

@gregster
I had my functions and commands mixed, I am stuck between v1 and v2 unfortunetly...

I completely missed that part of the documentation and sure enough my tests confirm your findings. Thank you!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww, vanove and 175 guests