Sign in to follow this  
Followers 0
Skitty

WinAPI Control hwnd to pseudo AutoIt hwnd?

5 posts in this topic

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? :‏)


Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Jos
removed spam

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

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()

Share this post


Link to post
Share on other sites

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 :)


Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0