Zaxon Posted August 7, 2006 Posted August 7, 2006 (edited) GUICtrlCreate* functions add controls to the window AutoIt has defined as current: either the last created window or one moved to via GUISwitch. Assuming that you want to access information about this current window from another function that hasn't created it (and for the point of this discussion doesn't want the window handle manually passed to it), is there a way of getting a window handle to the "current GUI window"? This would allow you to use functions like WinGetClientSize() to read information about the "current GUI window", which may not be the same as the currently active window in a Windows® sense. Edited August 7, 2006 by Zaxon
GaryFrost Posted August 7, 2006 Posted August 7, 2006 GUICtrlCreate* functions add controls to the window AutoIt has defined as current: either the last created window or one moved to via GUISwitch. Assuming that you want to access information about this current window from another function that hasn't created it (and for the point of this discussion doesn't want the window handle manually passed to it), is there a way of getting a window handle to the "current GUI window"? This would allow you to use functions like WinGetClientSize() to read information about the "current GUI window", which may not be the same as the currently active window in a Windows® sense. If it's the active window $handle = WinGetHandle ( WinGetTitle("")) Should do it SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Golbez Posted August 7, 2006 Posted August 7, 2006 $window = <name of the gui window> IF Not WinActive($window) Then WinActivate($window) put this b4 what u want 2 be it and it will be the right active window..
Zaxon Posted August 8, 2006 Author Posted August 8, 2006 All true but not what I'm looking for. So let me write you up some sample code. #include <guiconstants.au3> $window=guicreate("my window") guictrlcreatebutton("my button",100,100) guisetstate(@sw_show) ; fart around for a bit sleep(10000) ; call a pre-written library routine that gets data from the current GUI window some_library_routine() #cs I'm a separately written library routine. * I want to perform a task on the "current GUI window". * I don't know its name nor its handle. And for the sake of this exercise, I refused to ask for it. I need to discover it on my own. * I have to assume that between the time the window was open and the time I was called, that some other program running on the computer may have focused itself to the front. So I can't expect the window to be the active one. #ce func some_library_routine() $current_gui_window = magically_discovering_function() $client_size = WinGetClientSize($current_gui_window) endfunc The whole purpose of this exercise is that all GUICtrlCreate* functions magically know what the current GUI window is. So I want some library routines to also magically know, without being explicitly told, and without assuming the created window is still the active one.
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