datkewlguy Posted May 4, 2005 Posted May 4, 2005 I am trying to get it so that when i press the button the program will exit, but with the sleeps, it makes it too slow to get the message of the button, meaning it cant tell when u press it. Anyone have any solutions? #include <GUIConstants.au3> $countdown = 30 $w = 300 $h = 200 $l = (@DesktopWidth - $w) / 2 $t = (@DesktopHeight - $h) / 2 $bggui = GUICreate("Activate in:", $w, $h, $l, $t, $WS_MINIMIZEBOX + $WS_SYSMENU) $timer = GUICtrlCreateButton($countdown, 0, 0, 295, 150) GUICtrlCreateLabel( "Enter your key or press the button to abort", 0, 150) GUISetState() $msg = GUIGetMsg() While 1 $msg = GUIGetMsg() $countdown = $countdown - 1 GUICtrlSetData($timer, $countdown) If $countdown = 0 Then Exit Sleep(400) If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $timer Then Exit WEnd
themax90 Posted May 4, 2005 Posted May 4, 2005 While this may be a crude work around it's useful, and I don't have the timeto create a udf that checks the seconds with the computers clock. I'm sure one is already made just search. #include <GUIConstants.au3> $countdown = 200 $countnum = 30 $w = 300 $h = 200 $l = (@DesktopWidth - $w) / 2 $t = (@DesktopHeight - $h) / 2 $bggui = GUICreate("Activate in:", $w, $h, $l, $t, $WS_MINIMIZEBOX + $WS_SYSMENU) $timer = GUICtrlCreateButton($countdown, 0, 0, 295, 150) GUICtrlCreateLabel( "Enter your key or press the button to abort", 0, 150) GUISetState() $msg = GUIGetMsg() While 1 $msg = GUIGetMsg() $countdown = $countdown - 1 If IsInt($countdown/60) Then $countnum = $countnum - 1 GUICtrlSetData($timer, $countnum) EndIf If $countnum = 0 Then Exit If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $timer Then Exit WEnd
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now