Skitty Posted February 14, 2012 Share Posted February 14, 2012 So I just noticed that AutoIt uses a sort of pseudo ctrl handle when creating GUI controls after attempting to manipulate a control via a hwnd from an API call, is there any way of working with these handles with native autoit functions without having to do everything with API calls?For instance, I ran up on this while inserting a list view item at a position in a list view control when I noticed that the handle to manipulate the control returned by the API call was invalid for manipulation through the AutoIt native functions, such as GUICTRLDelete(), rendering me with only an option to continue manipulating the control via API calls which is not very nice at all.Any work around on this? :) Link to comment Share on other sites More sharing options...
Skitty Posted February 15, 2012 Author Share Posted February 15, 2012 (edited) Anyway, I'd also like to know how I can set the dock auto state to a control created with an API call. Edited February 15, 2012 by Jos removed spam Link to comment Share on other sites More sharing options...
KaFu Posted February 15, 2012 Share Posted February 15, 2012 I'm not sure if I get the question right. Control's are either identifed by their control ID (unique to the program) or their handle (unique for all windows). #include <Constants.au3> #include <GUIConstantsEx.au3> #include <WinApi.au3> #include <WindowsConstants.au3> Local $msg $hGUI = GUICreate("Parent GUI") $c_Label_1 = GUICtrlCreateLabel("TestMessageBox #1", 10, 10, 100) $c_Label_2 = GUICtrlCreateLabel("TestMessageBox #2", 10, 40, 100) GUISetState(@SW_SHOW) ; will display an empty dialog box ConsoleWrite($c_Label_1 & @crlf) ConsoleWrite(ControlGetHandle($hGUI,"",$c_Label_1) & @crlf) ConsoleWrite(_WinAPI_GetWindowLong(ControlGetHandle($hGUI,"",$c_Label_1), $GWL_ID) & @crlf) ConsoleWrite($c_Label_2 & @crlf) ConsoleWrite(ControlGetHandle($hGUI,"",$c_Label_2) & @crlf) ConsoleWrite(_WinAPI_GetWindowLong(ControlGetHandle($hGUI,"",$c_Label_2), $GWL_ID) & @crlf) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Skitty Posted February 15, 2012 Author Share Posted February 15, 2012 This guy was having the same problem as me, thanks for the help KaFu, but as it seems, you cannot interact with control handles returned by an api call using a native autoit control handling function. I guess my options are to rewrite a lot of code since this seems to be the case Link to comment Share on other sites More sharing options...
Developers Jos Posted February 15, 2012 Developers Share Posted February 15, 2012 (edited) Anyway, I'd also like to know how I can set the dock auto state to a control created with an API call.Would be helpful when you read our rules and stop creating extra work for us by quoting Spam posts in replies. Edited February 15, 2012 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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