ioa747 Posted July 5 Share Posted July 5 (edited) is there some other way to detect Active Control in GUI that I'm missing? expandcollapse popup; https://www.autoitscript.com/forum/topic/212043-active-control-in-gui/?do=findComment&comment=1535173 #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Local $Form1 = GUICreate("Form1", 286, 165, 853, 226) Local $Input1 = GUICtrlCreateInput("Input1", 10, 10, 121, 21) Local $Input2 = GUICtrlCreateInput("Input2", 10, 40, 121, 21) Local $Input3 = GUICtrlCreateInput("Input3", 10, 70, 121, 21) Local $Input4 = GUICtrlCreateInput("Input4", 10, 100, 121, 21) Local $Input5 = GUICtrlCreateInput("Input5", 10, 130, 121, 21) Local $Input6 = GUICtrlCreateInput("Input6", 140, 10, 121, 21) Local $Input7 = GUICtrlCreateInput("Input7", 140, 40, 121, 21) Local $Input8 = GUICtrlCreateInput("Input8", 140, 70, 121, 21) Local $Input9 = GUICtrlCreateInput("Input9", 140, 100, 121, 21) Local $Input10 = GUICtrlCreateInput("Input10", 140, 130, 121, 21) GUISetState(@SW_SHOW) Local $n = Random(0, 9, 1) Send("{TAB " & $n & "}") Local $id = GetActiveCtrl($Form1) Local $cInputData = GUICtrlRead($id) ConsoleWrite("ActiveCtrl=" & $cInputData & @CRLF) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func GetActiveCtrl($hGUI) Local $ActiveCtrl = ControlGetFocus($hGUI) ConsoleWrite("$ActiveCtrl=" & $ActiveCtrl & @CRLF) Local $hControl = ControlGetHandle($hGUI, "", $ActiveCtrl) ConsoleWrite("$hControl=" & $hControl & @CRLF) Local $hCtrl For $i = 3 To 100 $hCtrl = GUICtrlGetHandle($i) If @error Then ExitLoop If $hCtrl = $hControl Then Return $i Next Return SetError(1, 0, -1) EndFunc ;==>GetActiveCtrl Every comment is appreciated! Thank you very much Edited July 5 by ioa747 correction I know that I know nothing Link to comment Share on other sites More sharing options...
Solution Nine Posted July 5 Solution Share Posted July 5 Try this one : Func GetActiveCtrl($hGUI) Return _WinAPI_GetDlgCtrlID(ControlGetHandle($hGUI, "", ControlGetFocus($hGUI))) EndFunc ioa747 1 “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...
ioa747 Posted July 5 Author Share Posted July 5 I imagined that there would be something, but I couldn't find it Thank you very much I know that I know nothing 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