Sign in to follow this  
Followers 0
bmw74

Definitions for ProgressConstants include messages

3 posts in this topic

#1 ·  Posted (edited)

I am reposting this since the last edit made some portion of the original post disappear... sorry for the confusion.

Hello everyone,

I am working on a project where I need to display a "non-stopping" progress bar while a runwait command is being executed. I don't have a way to get the % or estimated time from the runwait, so all I am doing is displaying the progress bar with $PBM_SETMARQUEE option set, so it just runs in a loop and then I end it when the runwait finishes. As I started to look into ways to do this, I came across the ProgressConstants.au3 include, which has a Messages section with variables that you can send to the progress bar.

My questions are:

1. Does anyone has any type of documentation or help on what the possible values for the Messages section of the ProgressConstants.au3 include are? The include doesn't includes what the constant does, what values are accepted, etc.

For convenience, here is the section that I am talking about:

; #MESSAGES# ====================================================================================================================
Global Const $__PROGRESSBARCONSTANT_WM_USER = 0X400
Global Const $PBM_DELTAPOS = $__PROGRESSBARCONSTANT_WM_USER + 3
Global Const $PBM_GETBARCOLOR = 0x040F ; Vista
Global Const $PBM_GETBKCOLOR = 0x040E ; Vista
Global Const $PBM_GETPOS = $__PROGRESSBARCONSTANT_WM_USER + 8
Global Const $PBM_GETRANGE = $__PROGRESSBARCONSTANT_WM_USER + 7
Global Const $PBM_GETSTATE = 0x0411 ; Vista
Global Const $PBM_GETSTEP = 0x040D ; Vista
Global Const $PBM_SETBARCOLOR = $__PROGRESSBARCONSTANT_WM_USER + 9
Global Const $PBM_SETBKCOLOR = 0x2000 + 1
Global Const $PBM_SETMARQUEE = $__PROGRESSBARCONSTANT_WM_USER + 10
Global Const $PBM_SETPOS = $__PROGRESSBARCONSTANT_WM_USER + 2
Global Const $PBM_SETRANGE = $__PROGRESSBARCONSTANT_WM_USER + 1
Global Const $PBM_SETRANGE32 = $__PROGRESSBARCONSTANT_WM_USER + 6
Global Const $PBM_SETSTATE = 0x0410 ; Vista
Global Const $PBM_SETSTEP = $__PROGRESSBARCONSTANT_WM_USER + 4
Global Const $PBM_STEPIT = $__PROGRESSBARCONSTANT_WM_USER + 5
; ===============================================================================================================================

As you can see, when the runwait command ends, the progressbar just goes inactive. I would like to have it all filled up at 100%, to show that the process has finished. Also, looks like the controls are having some issues, since the status bar section gets all messed up if I minimize the app, so I am wide open for different approaches or suggestions.

Thanks everyone!

Edited by bmw74

Share this post


Link to post
Share on other sites



This works...

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()

    Local $hGUI, $hProgress, $hInput, $input, $progress, $hStatus, $PID
    Local $aParts[4] = [80, 160, 300, -1]

    ; Create GUI
    $hGUI = GUICreate("StatusBar Embed Control", 400, 300)

    ;===============================================================================
    ; defaults to 1 part, no text
    $hStatus = _GUICtrlStatusBar_Create($hGUI)
    _GUICtrlStatusBar_SetMinHeight($hStatus, 20)

    ;===============================================================================
    GUISetState()

    ; Initialize parts
    _GUICtrlStatusBar_SetParts($hStatus, $aParts)
    _GUICtrlStatusBar_SetText($hStatus, "Part 1")
    _GUICtrlStatusBar_SetText($hStatus, "Part 2", 1)

    ; Embed a progress bar


    If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
    Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE)
    EndIf

    $hProgress = GUICtrlGetHandle($progress)
    _GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
    _SendMessage(GUICtrlGetHandle($progress), $PBM_SETMARQUEE, True, 50) ; marquee works on Win XP and above
    $PID = RunWait(@ComSpec & " /c " & "Dir /p", @ScriptDir)
    GUICtrlSetStyle($progress, $PBS_SMOOTH)
    GUICtrlSetData($progress, 100)

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Awesome!! Thanks a lot Val, very helpful as usual.

Share this post


Link to post
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
Sign in to follow this  
Followers 0