Sign in to follow this  
Followers 0
penguini

Cannot get GUI to close

3 posts in this topic

I am trying to just experiment with making a GUI, and I get it created and everything is ok. But I cannot figure out how to exit the program / GUI when I hit the [X] button on the window. The code I'm trying to use / fix is:

#include <GUIConstants.au3>

GUICreate("TEST PROGRAM", 350, 145, 93, 15)
GUICtrlCreatePic("hamburger.jpg", 215, 35, 135, 112)
$firstbutton = GUICtrlCreateButton("First", 5, 25, 75, 25)
$secondbutton = GUICtrlCreateButton("Second", 5, 50, 75, 25)
$thirdbutton = GUICtrlCreateButton("Third", 5, 75, 75, 25)
GUICtrlSetOnEvent($firstbutton, "FirstClicked")
GUICtrlSetOnEvent($secondbutton, "SecondClicked")
GUICtrlSetOnEvent($lastbutton, "LastClicked")
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "CloseProg")

$starttime = @hour

While 1
    If $starttime = 2 Then
        Action()
        ExitLoop
    EndIf
WEnd

Func FirstClicked()
    $choicex = 309
    $choicey = 507
EndFunc

Func SecondClicked()
    $choicex = 309
    $choicey = 525
EndFunc

Func LastClicked()
    $choicex = 309
    $choicey = 493
EndFunc

Func Action()
    Run("C:\Program Files\Mozilla Firefox\firefox.exe")
    Sleep(10000)
    MouseMove(1000,64)
    Sleep(2000)
    MouseDown("left")
    MouseMove(258,64)
    MouseUp("left")
    Send("http://www.freewebs.com/{ENTER}")
    Sleep(10000)
    MouseClick("left", $choicex, $choicey)
    MouseClick("left", 307, 546)
EndFunc

Func CloseProg()
    Select
        Case @GUI_CTRLID = $GUI_EVENT_CLOSE
            MsgBox(1, "CLOSED", "CLOSED!")
            Exit
    EndSelect
EndFunc

Share this post


Link to post
Share on other sites



I'm pretty sure that

Func CloseProg()
    Select
        Case @GUI_CTRLID = $GUI_EVENT_CLOSE
            MsgBox(1, "CLOSED", "CLOSED!")
            Exit
    EndSelect
EndFunc

Since you already specified that it's $GUI_EVENT_CLOSE on line 12


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

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