# Function Reference

GUICtrlCreateProgress

Creates a Progress control for the GUI.

GUICtrlCreateProgress ( left, top [, width [, height [, style [, exStyle]]]] )

Parameters

left | The left side of the control. If -1 is used then left will be computed according to GUICoordMode.
top | The top of the control. If -1 is used then top will be computed according to GUICoordMode.
width | [optional] The width of the control (default is the previously used width).
height | [optional] The height of the control (default is the previously used height).
style | [optional] Defines the style of the control. See GUI Control Styles Appendix.
exStyle | [optional] Defines the extended style of the control. See Extended Style Table.

Return Value

Success: | Returns the identifier (controlID) of the new control.
Failure: | Returns 0.

Remarks

To obtain the value of the control see GUICtrlRead.
To set or change information in the control see GUICtrlSet....
To update the bar position just use GUICtrlSetData.
To combine styles with the default style use BitOr($GUI_SS_DEFAULT_PROGRESS, newstyle,...).
Default resizing is $GUI_DOCKAUTO size and position will occur.

Related

GUICoordMode (Option), GUICtrlSetData, GUICtrlSet..., GUIGetMsg

Example

#include <GUIConstants.au3>
GUICreate("My GUI Progressbar",220,100, 100,200)
$progressbar1 = GUICtrlCreateProgress (10,10,200,20)
GUICtrlSetColor(-1,32250); not working with Windows XP Style
$progressbar2 = GUICtrlCreateProgress (10,40,200,20,$PBS_SMOOTH)
$button = GUICtrlCreateButton ("Start",75,70,70,20)
GUISetState ()
$wait = 20; wait 20ms for next progressstep
$s = 0; progressbar-saveposition
do
$msg = GUIGetMsg()
If $msg = $button Then
GUICtrlSetData ($button,"Stop")
For $i = $s To 100
If GUICtrlRead($progressbar1) = 50 Then Msgbox(0,"Info","The half is done...", 1)
$m = GUIGetMsg ()
If $m = -3 Then ExitLoop
If $m = $button Then
GUICtrlSetData ($button,"Next")
$s = $i;save the current bar-position to $s
ExitLoop
Else
$s=0
GUICtrlSetData ($progressbar1,$i)
GUICtrlSetData ($progressbar2,(100 - $i))
Sleep($wait)
EndIf
Next
if $i >100 then
; $s=0
GUICtrlSetData ($button,"Start")
endif
EndIf
until $msg = $GUI_EVENT_CLOSE