Jump to content

Recommended Posts

Posted

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)

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.

Posted

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
Posted

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

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
×
×
  • Create New...