Sign in to follow this  
Followers 0
Suirad

multiple gui windows

6 posts in this topic

my script currently has 2(+) gui windows. the problem is, if i close one (the windows X) then guigetmsg() returns the same $gui_event_close no matter which window it came from. Is there a way to accurately return the correct window that was exited?

(trying to avoid using something like wingetactive() to find it)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try this maybe?

GuiSetOnEvent($GUI_EVENT_CLOSE, "close", $winhandle)
Edited by Hawkwing

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites

Try this maybe?

GuiSetOnEvent($GUI_EVENT_CLOSE, "close", $winhandle)

ah, that looks good. do you think a possible guiregistermsg() would be able to equivalent to the code above? i dont use guioneventmode :D

Share this post


Link to post
Share on other sites

Try

#include <GuiConstants.au3>

$iGuiCenter = @DesktopWidth / 2
$hGui1 = GUICreate("1", 150, 100, $iGuiCenter -250)
GUISetState()
$hGui2 = GUICreate("2", 150, 100, $iGuiCenter -80)
GUISetState()
$hGui3 = GUICreate("3", 150, 100, $iGuiCenter +90)
GUISetState()

$iWindows = 3
While 1
    $Msg = GUIGetMsg(1)
    Select
        Case $Msg[0] = $GUI_EVENT_CLOSE
            Switch $Msg[1]
                Case $hGui1
                    GUIDelete($hGui1)
                    $iWindows -= 1
                Case $hGui2
                    GUIDelete($hGui2)
                    $iWindows -= 1
                Case $hGui3
                    GUIDelete($hGui3)
                    $iWindows -= 1
            EndSwitch
            If Not $iWindows Then Exit
    EndSelect
WEnd

Share this post


Link to post
Share on other sites

thanks a ton picaxe :D

i knew there was something i was missing

Share this post


Link to post
Share on other sites

You are welcome.

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