Jump to content

Recommended Posts

Posted

I will try to explain to you
Notice my brother
I want to create a progress bar
It is linked to a specific time
For example, a progress bar offers a period of 10 seconds
I will explain exactly what I want to do
I want to close the computer after 10 seconds and give the user the option of canceling
At this time I want to have a progress bar for time
Greetings
I apologize for the inconvenience and thank you in advancei know how to create a progress

but i need to linke it with a timer i don't know how to do it

can we do that?

Posted (edited)
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("shutdown by AU3Builder", 300, 133, 192, 124)
$Progress1 = GUICtrlCreateProgress(16, 24, 209, 25)
$Label1 = GUICtrlCreateLabel("", 112, 112, 21, 17)
$Button1 = GUICtrlCreateButton(" Start Countdown", 64, 64, 105, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
         Countdown(20,20)
    EndSwitch
WEnd

Func Countdown($progressbar,$label)
$I = 0
Do
Sleep(1000)
$I = $I + 1
$label = $label - 1
GUICtrlSetData($Progress1,$I/$progressbar*100)
GUICtrlSetData($Label1,$label)
Until $i = $progressbar
EndFunc

Here you are :)

Edited by Au3Builder
Posted

thank you very much
Can you add a Cancel button when the progress bar is in progress?i need to update the progress bar any sec

I mean I want to link the progress bar to specific seconds

Posted
Quote

Can you add a Cancel button when the progress bar is in progress?

Not using the code above.  Once the loop starts you are not processing messages.

Quote

I mean I want to link the progress bar to specific seconds

Can you explain this further.  Still unclear what you want to do.

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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
×
×
  • Create New...