Jump to content

Recommended Posts

Posted (edited)

This may be very helpful to understanding the different types of progress bars that you can easily add into your projects.

Enjoy.

#include <GUIConstants.au3>
;Global Const $PBS_SMOOTH             = 0x00000001 ; The progress bar displays progress status in a smooth scrolling bar
;Global Const $PBS_VERTICAL         = 0x00000004 ; The progress bar displays progress status vertically
Global Const $PBS_MARQUEE            = 0x00000008 ; The progress bar moves like a marquee
Global $i=0

; Create GUI
$Form1 = GUICreate("Progress Demo By CyberZeroCool", 401, 301, 341, 258)
$Progress1 = GUICtrlCreateProgress(0, 0, 25, 297, BitOR($PBS_SMOOTH,$PBS_VERTICAL,$PBS_MARQUEE))
$Progress2 = GUICtrlCreateProgress(104, 0, 289, 25)
$Progress3 = GUICtrlCreateProgress(104, 56, 289, 25, $PBS_MARQUEE)
$Label1 = GUICtrlCreateLabel("-1 (NO STYLE)", 104, 32, 75, 17)
$Label2 = GUICtrlCreateLabel("$PBS_MARQUEE", 104, 88, 91, 17)
$Label3 = GUICtrlCreateLabel("$PBS_MARQUEE+$PBS_SMOOTH+$PBS_VERTICAL", 32, 280, 268, 17)
$Progress4 = GUICtrlCreateProgress(32, 0, 25, 265, BitOR($PBS_VERTICAL,$PBS_MARQUEE))
$Progress5 = GUICtrlCreateProgress(104, 112, 289, 25, $PBS_SMOOTH)
$Label4 = GUICtrlCreateLabel("$PBS_SMOOTH", 104, 144, 84, 17)
$Progress6 = GUICtrlCreateProgress(104, 162, 289, 25, BitOR($PBS_SMOOTH,$PBS_MARQUEE))
$Label5 = GUICtrlCreateLabel("$PBS_MARQUEE+$PBS_SMOOTH", 104, 194, 177, 17)
$Label6 = GUICtrlCreateLabel("$PBS_MARQUEE+$PBS_VERTICAL", 64, 248, 182, 17)
$Progress7 = GUICtrlCreateProgress(64, 0, 25, 233, $PBS_VERTICAL)
$Label7 = GUICtrlCreateLabel("$PBS_VERTICAL", 92, 220, 89, 17)

GUISetState()

AdlibEnable("Advance", 50)

; Loop until user exits
do
until GUIGetMsg() = $GUI_EVENT_CLOSE

Func Advance()
$i=$i+1
GUICtrlSetData($Progress1, $i)
GUICtrlSetData($Progress2, $i)
GUICtrlSetData($Progress3, $i)
GUICtrlSetData($Progress4, $i)
GUICtrlSetData($Progress5, $i)
GUICtrlSetData($Progress6, $i)
GUICtrlSetData($Progress7, $i)
If $i = 100 Then $i = 0
EndFunc
Edited by CyberZeroCool
Check out ConsultingJoe.com
Posted

Nice demo , thank you,

You might want to mention that theses styles will not override windows xp default theme of progress bar unless in classic mode..

Cheers

Posted (edited)

Nice demo , thank you,

You might want to mention that theses styles will not override windows xp default theme of progress bar unless in classic mode..

Cheers

Thanks guys.

The only one that doesn't work for me in XP theme is the Smooth. Everything else works just fine in both

Edited by CyberZeroCool
Check out ConsultingJoe.com
Posted (edited)

The only one that doesn't work for me in XP theme is the Smooth.

It appears that this problem is easily fixable.

Just add

DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", "", "wstr", "")

after you create a progress bar.

Good thing with classic look is that setting color and background color works too :) Default blue on gray looks boring.

Edited by Siao

"be smart, drink your wine"

Posted

Maybe...

From Autoit wrappers and your gui

#include <GuiConstants.au3>
#include <GUIConstants.au3>
;Global Const $PBS_SMOOTH              = 0x00000001 ; The progress bar displays progress status in a smooth scrolling bar
;Global Const $PBS_VERTICAL            = 0x00000004 ; The progress bar displays progress status vertically
Global Const $PBS_MARQUEE             = 0x00000008 ; The progress bar moves like a marquee
Global $i=0, $XS_n

; Create GUI
$Form1 = GUICreate("Progress Demo By CyberZeroCool", 401, 301, 341, 258)
XPStyle()   
$Progress1 = GUICtrlCreateProgress(0, 0, 25, 297, BitOR($PBS_SMOOTH,$PBS_VERTICAL,$PBS_MARQUEE))
$Progress2 = GUICtrlCreateProgress(104, 0, 289, 25)
$Progress3 = GUICtrlCreateProgress(104, 56, 289, 25, $PBS_MARQUEE)
$Label1 = GUICtrlCreateLabel("-1 (NO STYLE)", 104, 32, 75, 17)
$Label2 = GUICtrlCreateLabel("$PBS_MARQUEE", 104, 88, 91, 17)
$Label3 = GUICtrlCreateLabel("$PBS_MARQUEE+$PBS_SMOOTH+$PBS_VERTICAL", 32, 280, 268, 17)
$Progress4 = GUICtrlCreateProgress(32, 0, 25, 265, BitOR($PBS_VERTICAL,$PBS_MARQUEE))
$Progress5 = GUICtrlCreateProgress(104, 112, 289, 25, $PBS_SMOOTH)
$Label4 = GUICtrlCreateLabel("$PBS_SMOOTH", 104, 144, 84, 17)
$Progress6 = GUICtrlCreateProgress(104, 162, 289, 25, BitOR($PBS_SMOOTH,$PBS_MARQUEE))
$Label5 = GUICtrlCreateLabel("$PBS_MARQUEE+$PBS_SMOOTH", 104, 194, 177, 17)
$Label6 = GUICtrlCreateLabel("$PBS_MARQUEE+$PBS_VERTICAL", 64, 248, 182, 17)
$Progress7 = GUICtrlCreateProgress(64, 0, 25, 233, $PBS_VERTICAL)
$Label7 = GUICtrlCreateLabel("$PBS_VERTICAL", 92, 220, 89, 17)
XPStyle(0)   
GUISetState()

AdlibEnable("Advance", 50)

; Loop until user exits
do
until GUIGetMsg() = $GUI_EVENT_CLOSE

Func Advance()
$i=$i+1
GUICtrlSetData($Progress1, $i)
GUICtrlSetData($Progress2, $i)
GUICtrlSetData($Progress3, $i)
GUICtrlSetData($Progress4, $i)
GUICtrlSetData($Progress5, $i)
GUICtrlSetData($Progress6, $i)
GUICtrlSetData($Progress7, $i)
If $i = 100 Then $i = 0
EndFunc
 
 Func XPStyle($OnOff = 1)   
    If $OnOff And StringInStr(@OSTYPE, "WIN32_NT") Then
        $XS_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
        Return 1
    ElseIf StringInStr(@OSTYPE, "WIN32_NT") And IsArray($XS_n) Then
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $XS_n[0])
        $XS_n = ""
        Return 1
    EndIf
    Return 0
EndFunc   ;==>XPStyle

8)

NEWHeader1.png

Posted

This may be very helpful to understanding the different types of progress bars that you can easily add into your projects.

Yes, indeed. Thanks a lot :)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...