Page 1 of 1

Get all controls under the cursor  Topic is solved

Posted: 06 Dec 2015, 17:08
by martin12
I am working with toolbars in a program where the buttons are reported as one control and the frame around the buttons is reported as a different control. The frame control has text naming the toolbar but the button control does not. Is there a way to get all the controls under a mouse click instead of just the top control? Thanks.

Re: Get all controls under the cursor

Posted: 06 Dec 2015, 22:46
by timelizards
i find PostMessage works well for me for clicking toolbar buttons (and items in right click menus sometimes)

winget will get all controls in a window with the cmd controllist, but i dont know if the buttons you are looking for will show up - might be worth a look if you havent already

Re: Get all controls under the cursor

Posted: 07 Dec 2015, 09:10
by Martin12
Thanks for the response. I think I left too much out in my attempt to avoid tl;dr.

What I need to do is detect which toolbar button is clicked. The toolbars are docked, but the program can open windows of varying sizes on the right side of the screen that move some of the toolbars so I can't just use the mouse position x and y for the screen. There is no text on the toolbar buttons control that I have been able to access. There are unique tool tips on the buttons but the AHK code I've tried so far does not read the tool tips. Since the control below the toolbar button control (should I call that a frame for the toolbar?) has text which names the toolbar I could calculate offsets to determine which button was clicked if I could access that second control, but the options I've tried so far provide data for just the top control with the toolbar buttons or provide data for all the controls on the screen. There are enough controls on the screen that I think it would slow down the program if I looped through all the controls for every mouse click.

Re: Get all controls under the cursor

Posted: 28 Jan 2022, 11:50
by LAPIII
timelizards wrote:
06 Dec 2015, 22:46
i find PostMessage works well for me for clicking toolbar buttons (and items in right click menus sometimes)
Could you post a script please?

Re: Get all controls under the cursor

Posted: 28 Jan 2022, 15:19
by Smile_