Old 24th June 2011, 10:54   #1
Join Date: Apr 2011
Posts: 56
ProgressBar with silent silentMod


please i use a silent mode for my installation, but I notied that installation is so silent , i don't have any sign, i would like using progress bar for user.

in my research I found the progress bar in a page, but my need is just a progress without page to have in idea for the progress installation.

Please help me.

hanenjom is offline   Reply With Quote
Old 24th June 2011, 11:54   #2
Afrow UK
Afrow UK's Avatar
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I would really suggest NOT having a progress bar. It really annoys me when I want to install a 3rd party program or run a 3rd party command line application with a silent switch that isn't silent. The whole point of a silent switch is so that the caller can manage progress while waiting for your process to complete, perhaps with a simple one line message.

But to answer your question, this can't be done properly (i.e. like the NSIS progress bar) because in silent mode there is no NSIS UI and so no progress messages are sent (PBM_SETPOS). You can still use a plug-in such as Banner or NXS to show a message to the user but again this defeats the purpose of a silent install.

Afrow UK is offline   Reply With Quote
Old 24th June 2011, 12:51   #3
Join Date: Apr 2011
Posts: 56

thx for you answers
hanenjom is offline   Reply With Quote
Old 24th June 2011, 16:49   #4
Anders's Avatar
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,311
This is ugly, but it sort of works:

!include LogicLib.nsh
!include FileFunc.nsh

Var SilentGUI
!define SILENTGUI_INSTJUMP 2 ;page jump from first page to instfiles

!define SWP_NOMOVE 0x0002
!define SWP_NOZORDER 0x0004
!define SWP_NOSIZE 0x0001
!define SWP_FRAMECHANGED 0x0020

Function .onGuiInit
${GetParameters} $0
${GetOptions} $0 "/SilentGUI" $0
${IfNot} ${Errors}
StrCpy $SilentGUI 1
System::Call 'USER32::SetWindowLong(i $HWNDPARENT,i -16,i 0x800008C8|0x00400000)'
SendMessage $HWNDPARENT "0x408" "${SILENTGUI_INSTJUMP}" ""

Function InstFilesShow
${IfNotThen} $SilentGUI <> 0 ${|} Return ${|}
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $9 $0 0x3EC
StrCpy $1 ""
FindWindow $1 "" "" $0 $1
ShowWindow $1 0
StrCmp $1 0 "" hideloop
ShowWindow $9 1
System::Call '*(i,i,i,i)i.r0'
System::Call 'USER32::GetClientRect(i $9,ir0)'
System::Call '*$0(i,i,i,i.r2)i'
System::Call 'USER32::GetClientRect(i $HWNDPARENT,ir0)'
System::Call '*$0(i,i,i.r1,i)i'
IntOp $3 $1 - 25
System::Call 'USER32::SetWindowPos(i $9,i,i0,i0,ir3,ir2,i ${SWP_NOZORDER})'
System::Free $0
IntOp $2 $2 + 25
System::Call 'USER32::SetWindowPos(i $HWNDPARENT,i,i,i,ir1,ir2,i ${SWP_NOMOVE}|${SWP_NOZORDER}|${SWP_FRAMECHANGED})'

Function InstFilesLeave
${If} $SilentGUI <> 0

Sleep 1000
Sleep 1000
Sleep 1000
Sleep 1000

Page Components
Page Directory
Page InstFiles "" InstFilesShow InstFilesLeave
Run with setup.exe /silentgui

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump