Progress Bar Show Complete

Started by Jeremy Whilde, June 30, 2014, 08:25:20 AM

Previous topic - Next topic

Jeremy Whilde

I have used one of the progress bar examples from

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+winbatch/Samples~from~Users/Dialogs+Various~Progress~Bar~Samples.txt

Specifically the "DllCall CreateWindowExA msctls_progress32 Progress Bar"

This works well apart from it would be good to set the progress bar to a specific point particularly to show 100% when required.
I modified the while loop and tried to send the step to 100% but this does not seem to work, the bar just flashes and
remains at what ever point it has been stepped to!?

Is there a way to be able to set the position of the progress bar?

; Last section of code from example modified (does not set bar to 100%!?)

i = 0
While @True ;AppExist("Calc.exe",@false)
   
   TimeDelay(1)
   i = i + 1
   ;udfProgressBarTick( hProgBar )

   If WinExist("Calculator")
      udfProgressBarTick( hProgBar )
   Else
      hProgBar = udfProgressBarCreate(3,75,75,500,25,100,title) ; Why does this not send the bar to 100%?
      TimeDelay(2)
     Break
   Endif

EndWhile

Message("","Done")
Exit

Thanks JW

Deana

That udfProgressBarCreate UDF creates a new progress bar and only allows you to specify the step increment on each call to udfProgressBarTick. The udfProgressBarTick simply sends the PBM_STEPIT (1029) message (1029) which merely advances the current position for a progress bar by the step increment and redraws the bar to reflect the new position.

If you're trying to set the progress bar to a specific position, rather than stepping it, you should be using PBM_SETPOS not PBM_STEPIT:
http://msdn.microsoft.com/en-us/library/bb760844.aspx


Code (winbatch) Select
#DefineFunction udfProgressBarPos(hProgBar,position)
   WM_USER = 1024
   PBM_SETPOS = WM_USER + 2
   user32=StrCat(DirWindows(1),"user32.dll")
   Return DllCall(user32,long:"SendMessageA",long:hProgBar,long:PBM_SETPOS,long:position,long:0)
#EndFunction

udfProgressBarPos(hProgBar,100) ; Show Complete
Deana F.
Technical Support
Wilson WindowWare Inc.

Jeremy Whilde

Deana

Thank you just what was needed.

Thanks JW