Archive: Infinite ProgressBar


Infinite ProgressBar
  Hi,

I'm a nsis newbie, and have created a script to install a program, and uninstall the existing version, before installing a new one. I run the uninstaller in silent mode, so there is no progressbar during uninstallation, but maybe a infinite for a long time job?
Is it possible, to show a infinite progress bar during uninstalling of the old version?
Thank you in advance.

Regards,
Boian


You could play with one of the banner plugins or the LoadingBAR UI for your uninstaller:
http://nsis.sourceforge.net/LoadingBar_UI

http://nsis.sourceforge.net/MSIBanner_plug-in (old)
http://nsis.sourceforge.net/NxSMSILoaderDlg_plug-in (slightly less old)
http://nsis.sourceforge.net/Nxs_plug-in (least old)


Thank you for the response. I have downloaded the plugins, and have already a solution to show a dialog with the progress bar, during execution of the longtime process. Is it possible, to integrate the progressBar into a NSIS installer page?

I have found that the NSdialog, already contains a ProgressBar (NSD_CreateProgressBar), but there is no documentation, how i can use it, and set a value.

Regards,
Boian


well if you want it inside a dialog, then your uninstaller isn't very 'silent' anymore, is it? ;)

The nsDialogs progressbar you'd probably have to alter using windows messaging. See also this thread:
http://forums.winamp.com/showthread.php?postid=2575941

Just in short, you'd want to set up a range...
sendMessage ProgressControl_hwnd ${PBM_SETRANGE32} start end ; e.g. 0 100 for a standard 0%-100% progressbar

And then set the value in your script where appropriate...
sendMessage ProgressControl_hwnd ${PBM_SETPOS} value 0 ; e.g. 33 0 for 33%

ProressControl_hwnd is what you get in the Pop after creating the item with nsDialogs.
PBM_SETRANGE and PBM_SETPOS are defined in WinMessages.nsh (ships with NSIS) - so be sure to include that if you aren't already.

If you want it to be one of those marquee progressbars that just continually loop from left to right, you probably have to set up some manner of style on the thing.. haven't looked into that :)
Edit: This page is informative, though: http://msdn.microsoft.com/en-us/libr...#Marquee_Style


complete example...

!include "WinMessages.nsh"

>!include "MUI2.nsh"
>!include "nsDialogs.nsh"

>OutFile "test.exe"

>Section
SectionEnd

>Var dialog
>Var hwnd
>Var null

>!define PB_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
!define PBS_MARQUEE 0x08

Page Custom page.custom
>Function page.custom
nsDialogs::Create 1018
Pop $dialog

nsDialogs::CreateControl "msctls_progress32"
${DEFAULT_STYLES}|${PBS_MARQUEE}
${PB_EXSTYLE}
0 0 100% 10%
"Test"
Pop $hwnd

${NSD_CreateTimer} NSD_Timer.Callback 10 ; Need a timer to kickstart the marquee progressbar
nsDialogs::Show
FunctionEnd

>Function NSD_Timer.Callback
SendMessage $hwnd${PBM_SETMARQUEE} 1 50 ; start=1|stop=0 interval(ms)=+N
${NSD_KillTimer} NSD_Timer.Callback ; Kill the timer
MessageBox MB_YESNO"Stop the marquee?" IDNO +2
SendMessage $hwnd${PBM_SETMARQUEE} 0 0
FunctionEnd

>!insertmacro MUI_LANGUAGE "English"
Essentially you would put all of your actions inside the function that is being called, and start/stop/slow-down/speed-up the progressbar from there.

Edit: The Marquee-style progressbar is not available with all visual themes, though. If you comment out the MUI2 lines, you'll see that in the non-MUI visual theme, there is no marquee effect. Something to keep in mind :)

And one more reply.... This is a plugin we actually use for our uninstaller to set the progress of the built-in un.InstFiles page to a correct amount (we use a stored list to delete only installed files, and the built-in progress handling only goes by the number of commands it knows about, so direct control to show a correct progress was needed):
http://nsis.sourceforge.net/RealProgress_plug-in

Note that this plugin does -not- do any marquee style handling - that's not what it's for :D


I have updated the nsDialogs FAQ wiki topic with some more progress bar examples:
http://nsis.sourceforge.net/NsDialogs_FAQ