Jump to content

Timeout of GUICreated window.


MadBoy
 Share

Recommended Posts

How to make a box that was created with GUICreate (with few buttons there) to timeout after 20 seconds from showing up and if no other action is taken. Tried to look for Timeout word in forum or autoit_help file but all i found was MsgBox timeouts.

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

Here is alittle example for you that times out after 20 seconds like a messagebox. I even added a time label to show the progress to show. :lmao: If this is not exactly what you are looking for then the TimerInit() maybe the key to what you want. I am not sure of the term "showing up without other action" as that could mean almost anything.

#include <GUIConstants.au3>

GUICreate('Sample', 220, 100)
$ok = GUICtrlCreateButton('OK', 20, 20, 50)
$extra = GUICtrlCreateButton('Extra', 140, 20, 50)
$cancel = GUICtrlCreateButton('Cancel', 80, 20, 50)
$label = GUICtrlCreateLabel(0, 100, 60, 50); time label
GUISetState(@SW_SHOW)

$time = TimerInit(); start timer
Do
    $msg = GUIGetMsg()
    GUICtrlSetData($label, Int(TimerDiff($time)/1000)); update time label
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg <= 0
            ContinueLoop
        Case $msg = $ok
            MsgBox(0, '', 'OK pressed')
        Case $msg = $extra
            MsgBox(0, '', 'Extra pressed')
        Case $msg = $cancel
            MsgBox(0, '', 'Cancel pressed')
            Exit
    EndSelect
Until TimerDiff($time) > 20000; check timeout

MsgBox(0, '', 'Timeout happened', 3)
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...