tomua999 Posted April 10, 2023 Share Posted April 10, 2023 I compile this code below to "MyGui.exe" #include <GUIConstantsEx.au3> $hWnd = GUICreate('MyGui',600,300) $a=GUICtrlCreateButton ( "text", 0,0,200,100 ) $b=GUICtrlCreateButton ( "text", 220,0,200,100 ) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $a MsgBox('','','a') Case $b MsgBox('','','b') EndSwitch WEnd And I run "MyGui.exe" After that I write another code like this code below to controlclick to click X,Y position in MyGui but it can't. I know [Class:Button;Instance:1] but I want to click X,Y position on MyGui, and I used button to check if It clicked. Opt("MouseCoordMode", 2) Opt("PixelCoordMode", 2) $cs=WinGetHandle('MyGui') ControlClick($cs,'','','left',1,319,47) Link to comment Share on other sites More sharing options...
Nine Posted April 10, 2023 Share Posted April 10, 2023 (edited) Yes there is a few problems with your approach. 1- As per help file : "Some controls will resist clicking unless they are the active window" By activating the window, it will work with the current focused control if your position (x/y) is inside to the current control. 2- If you want to click on another control than the current one, you will need to give it focus first. If you are clicking outside the focused control, it will not work. 3- You are not using the right functions to achieve whatever your goal is. ps. Please use tags when you post code, as described in the link. Edited April 10, 2023 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now