chickendavis
8th May 2008 23:48 UTC
Endless Progress Bar?
Hi everyone,
I have a need to execute a process during my installation but there is no way for me to know how long it will take. I was wondering if there is any sort of endless progress bar available for use in NSIS? ie. a bar that is constantly moving but doesn't necessarily go from 0 to 100%.
I know one option is to use the GradualProgress function on the RealProgress plugin but this isn't quite what im looking for because it goes from 0 to 100 and once it reaches 100, it stays there until the task is done.
Is anyone aware of such a progress indicator for nsis?
Appreciate any answers.
Thanks.
-Dave
Red Wine
9th May 2008 05:43 UTC
You could the trick by adding a loop after Exec command, e.g.
Exec "Some_Application.exe"
Sleep 2000
loop:
FindWindow $R0 "Some_Application_WindowClass" "Some_Application_WindowTitle"
Sleep 1000 ;might need to decrease sleep time
IsWindow $R0 loop
Doing this in a section would show progress bar somehow blinking.
{_trueparuex^}
9th May 2008 12:29 UTC
In Windows XP or later you can set the progress bar in maraquee mode. :)
!define PBM_SETMARQUEE 0x040A
!define PBS_MARQUEE 0x08
!ifndef GWL_STYLE
!define GWL_STYLE -16
!endif
; Get progress bar handle.
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1004
; Set PBS_MARQUEE style for the progress bar control.
System::Call "user32::GetWindowLong(i $0, i ${GWL_STYLE}) i .r1"
System::Call "user32::SetWindowLong(i $0, i ${GWL_STYLE}, i $1|${PBS_MARQUEE})"
; Send PBM_SETMARQUEE message to start the marquee.
; lParam is time in milliseconds between marquee animation updates.
SendMessage $0 ${PBM_SETMARQUEE} 1 50
Sleep 5000 ; do your thing
; Stop the marquee and set the old styles back for the progress bar control.
SendMessage $0 ${PBM_SETMARQUEE} 0 0
System::Call "user32::SetWindowLong(i $0, i ${GWL_STYLE}, i $1)"
chickendavis
9th May 2008 18:14 UTC
Thanks very much for the suggestions 'Red Wine' and '{_trueparuex^}'. I will do some testing and decide which of these optiosn is best for me.
-Dave
jweinraub
4th September 2008 14:46 UTC
I like this but it isn't what I thought it would do. I got a small segment and it moved.
I rather have the entire thing filled partially and it moves similarly to how Win XP boots. Or how Internet Explorer does downloads when it doesn't know how big it is.