I've been doing a lot of automation lately. In some cases I can't avoid using simulated mouse clicks. Unfortunately at my workplace there are programs which randomly pop up to steal the focus and ruin my program.
I can use this code to send a click to a specific UI element if I know it's handle even if it's in background.
Unfortunately there some UI elements (toolboxes) the handles of which I can't find out, or sometimes sendmessage doesn't trigger the event I need. In these cases I use this:
However for this to work the target window has to be on top. (or the part where I click should be visible on the screen) I would like to have a code which does the same as this, but the click would only go to the program with the handle I specify.
Thanks
I can use this code to send a click to a specific UI element if I know it's handle even if it's in background.
Code:
Call SendMessage(cmb, WM_LBUTTON_DOWN, ByVal 0&, 0&)
Call SendMessage(cmb, WM_LBUTTON_UP, ByVal 0&, 0&)
Code:
SetCursorPos 800, 200 'x and y position
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Thanks