Letraindusoir Posted March 31, 2019 Share Posted March 31, 2019 Given a handle, how can it be used to determine whether it is a form or a control? In AU3 functions, forms and controls use different functions, and some properties of forms or controls are different. How to determine whether a handle is a form or a control by a fetched handle (for example, a handle from a point) Link to comment Share on other sites More sharing options...
BugFix Posted March 31, 2019 Share Posted March 31, 2019 This may help you: #include <WinAPI.au3> #include <GUIListView.au3> Local $hGui = GUICreate('test') Local $cLV1 = GuiCtrlCreateListView('1|2', 10, 10, 200, 150) Local $hLV2 = _GUICtrlListView_Create($hGui, 'A|B', 10, 180, 200, 150) GUISetState() ConsoleWrite('_WinAPI_GetDlgCtrlID($hGui): ' & _GetCtrlID($hGui) & @CRLF) ConsoleWrite('_WinAPI_GetDlgCtrlID($cLV1): ' & _GetCtrlID($cLV1) & @CRLF) ConsoleWrite('_WinAPI_GetDlgCtrlID($hLV2): ' & _GetCtrlID($hLV2) & @CRLF) Do Until GUIGetMsg() = -3 Func _GetCtrlID($vWnd) Local $hWnd = IsHWnd($vWnd) ? $vWnd : GUICtrlGetHandle($vWnd) Return _WinAPI_GetDlgCtrlID($hWnd) EndFunc Best Regards BugFix Link to comment Share on other sites More sharing options...
Letraindusoir Posted March 31, 2019 Author Share Posted March 31, 2019 6 hours ago, BugFix said: This may help you: #include <WinAPI.au3> #include <GUIListView.au3> Local $hGui = GUICreate('test') Local $cLV1 = GuiCtrlCreateListView('1|2', 10, 10, 200, 150) Local $hLV2 = _GUICtrlListView_Create($hGui, 'A|B', 10, 180, 200, 150) GUISetState() ConsoleWrite('_WinAPI_GetDlgCtrlID($hGui): ' & _GetCtrlID($hGui) & @CRLF) ConsoleWrite('_WinAPI_GetDlgCtrlID($cLV1): ' & _GetCtrlID($cLV1) & @CRLF) ConsoleWrite('_WinAPI_GetDlgCtrlID($hLV2): ' & _GetCtrlID($hLV2) & @CRLF) Do Until GUIGetMsg() = -3 Func _GetCtrlID($vWnd) Local $hWnd = IsHWnd($vWnd) ? $vWnd : GUICtrlGetHandle($vWnd) Return _WinAPI_GetDlgCtrlID($hWnd) EndFunc Thanks BugFix ! Now I know that _ WinAPI_GetDlgCtrlID is so useful. It looks like windows, controls, ID and handles are explained more in MFC, so I'll find some learning materials to learn. Thanks again! Link to comment Share on other sites More sharing options...
Letraindusoir Posted March 31, 2019 Author Share Posted March 31, 2019 (edited) In addition, I would like to ask two more questions: 1, Use "Au3Info. Exe" when collecting window information, what is the function or method in which the "instance" is obtained? such as, WinWaitActive ("[TITLE: my window; CLASS: my class; INSTANCE:2] ",") 2, if want to use the "X\ Y\ W\ H-window location and size" attributes to identify the window, how do write the expression? [TITLE: my window; CLASS: my class; INSTANCE:2;64\ 128\ 435\ 218]? Thanks in advance.... Edited March 31, 2019 by Letraindusoir Link to comment Share on other sites More sharing options...
Letraindusoir Posted April 2, 2019 Author Share Posted April 2, 2019 (edited) On 3/31/2019 at 11:21 PM, Letraindusoir said: In addition, I would like to ask two more questions: 2, if want to use the "X\ Y\ W\ H-window location and size" attributes to identify the window, how do write the expression? [TITLE: my window; CLASS: my class; INSTANCE:2;64\ 128\ 435\ 218]? Thanks in advance.... I searched and only find one topic in the forum: ControlSetText($_currentWindowHWND, "", "[X:1081; Y:9; W:188; H:15]", $_orderNumber) Edited April 2, 2019 by Letraindusoir 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