Jump to content

GUI timeout


xah
 Share

Recommended Posts

I want to set a timeout for the GUI, but I can't get it to work.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Timers.au3>

Local $doorgaan, $overslaan, $msg

$hGUI = GUICreate("AH-Tool", 190, 85)
GUISetStyle(BitOR($WS_CAPTION, $WS_POPUPWINDOW) )

GUICtrlCreateLabel("LOT01101", 10, 10)
$doorgaan = GUICtrlCreateButton("Doorgaan", 10, 30, 80, 20)
$overslaan = GUICtrlCreateButton("Overslaan", 100, 30, 80, 20)

GUISetState() ; display the GUI
_Timer_SetTimer($hGUI, 2000, "Quit"); create timer

While 1
    $msg = GUIGetMsg()
    Sleep(1000)
    Switch $msg
        Case $doorgaan
            GUIDelete()
            MsgBox(0, "Info", "$doorgaan")
            Exit
        Case $overslaan
            GUIDelete()
            MsgBox(0, "Info", "$overslaan")
            Exit
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            Exit
    EndSwitch
WEnd

Func Quit()
    Exit
EndFunc

Help please, I just need this GUI to timeout and quit.

Link to comment
Share on other sites

The called func expects params.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Timers.au3>

Local $doorgaan, $overslaan, $msg

$hGUI = GUICreate("AH-Tool", 190, 85)
GUISetStyle(BitOR($WS_CAPTION, $WS_POPUPWINDOW) )

GUICtrlCreateLabel("LOT01101", 10, 10)
$doorgaan = GUICtrlCreateButton("Doorgaan", 10, 30, 80, 20)
$overslaan = GUICtrlCreateButton("Overslaan", 100, 30, 80, 20)

GUISetState() ; display the GUI
_Timer_SetTimer($hGUI, 2000, "Quit")

While 1
    $msg = GUIGetMsg()
    Sleep(10)
    Switch $msg
        Case $doorgaan
            GUIDelete()
            MsgBox(0, "Info", "$doorgaan")
            Exit
        Case $overslaan
            GUIDelete()
            MsgBox(0, "Info", "$overslaan")
            Exit
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            Exit
    EndSwitch
WEnd

Func Quit($hWnd, $Msg, $iIDTimer, $dwTime)
    Exit
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...