Jump to content

Help for a GUI Noob


orlith
 Share

Recommended Posts

Hi There

After reading most of posts, i'm still noob muttley with GUI

What I would like to do is a simple windows with a coutdown (30 s), a text message, and a cancel button.

The purpose of this windows is to let the choice to a user to cancel the reboot of the computer during 30s. If he doesn't click the cancel button, the windows close and the computer reboot. The cancel button must be (in a perfect world) the only way to close the windows.

After that I'll play and probably add a progress bar.

any help will be welcome.

thanks a lot

Link to comment
Share on other sites

Hi There

After reading most of posts, i'm still noob muttley with GUI

What I would like to do is a simple windows with a coutdown (30 s), a text message, and a cancel button.

The purpose of this windows is to let the choice to a user to cancel the reboot of the computer during 30s. If he doesn't click the cancel button, the windows close and the computer reboot. The cancel button must be (in a perfect world) the only way to close the windows.

After that I'll play and probably add a progress bar.

any help will be welcome.

thanks a lot

#include <Process.au3>
$GUI = GUICreate("Restart...",200,200,-1,-1,0x16C80000,00000188)
$LABEL = GUICtrlCreateLabel("Click cancel if you don't want to restart your computer",5,5,190,50,0x01)
$PROGRESS = GUICtrlCreateProgress(5,65,190,20)
$BUTTON = GUICtrlCreateButton("CANCEL",50,150,100,30)
GUISetState(@SW_SHOW)
$TIME = TimerInit()
While 1
    If GUIGetMsg() = $BUTTON Then
        Exit
    EndIf
    GUICtrlSetData($PROGRESS,Int(TimerDiff($TIME)/1000*3.33333))
    If TimerDiff($TIME) >= 30000 Then
        _RunDOS("shutdown -r -f")
    EndIf
WEnd
Edited by Andreik

When the words fail... music speaks.

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...