2014-12-19 422 views
0

我想知道這是否是可以執行以下UI修改/調整(以編程方式NSI腳本),而安裝在MUI_PAGE_INSTFILES頁上運行:NSIS如何在安裝過程中修改MUI_PAGE_INSTFILES?

  1. 設置進度條的風格勞斯萊斯(連續的「滾動」)

  2. 隱藏細節文本字段(其中顯示進度文本),並顯示一個預定義的圖像,而不是(所包含的設置)

[編輯]另外,對於數字2:可能會縮小細節字段,並將圖片顯示爲正下方的橫幅標籤(以便細節字段僅佔用垂直空間的一半,而使用其中的另一半通過圖片 - 這樣一個用戶可以看到進展和「橫幅」)。

[編輯]更妙的是仍然是有某種基本的幻燈片:即在安裝的部分定義一些圖片和旋轉它們每隔10秒

Sample graphic of what I want

這背後的想法是這可能需要一些時間(例如10秒以上)來向用戶顯示更多信息/有價值的內容,諸如如何開始圖形,促銷或其他事情。

這怎麼辦?

謝謝。

回答

1
XPStyle on ; This must be on for the Marquee to show 
!include nsDialogs.nsh ; For WS_* and NSD_SetImage 
!include WinMessages.nsh 
!ifndef PBS_MARQUEE 
!define PBS_MARQUEE 8 
!endif 
!ifndef PBM_SETMARQUEE 
!define PBM_SETMARQUEE 0x40A 
!endif 

!macro ProgressMarquee_Begin 
FindWindow $0 "#32770" "" $HWNDPARENT ; Find inner dialog 
GetDlgItem $0 $0 1004 ; Find progress-bar 
System::Call USER32::GetWindowLong(ir0,i-16)i.r1 
IntOp $1 $1 | ${PBS_MARQUEE} 
System::Call USER32::SetWindowLong(ir0s,i-16,ir1s) ; This also saves the handle and style on the stack, we need those to turn it off again. 
SendMessage $0 ${PBM_SETMARQUEE} 1 0 ; The last parameter is the speed or 0 for the default 
!macroend 
!macro ProgressMarquee_Remove 
Exch 
Pop $1 
IntOp $0 ${PBS_MARQUEE} ~ 
IntOp $1 $1 & $0 
System::Call USER32::SetWindowLong(is,i-16,ir1) 
!macroend 

Function DoLongOperation 
DetailPrint "Starting long operation" 
Sleep 4444 
DetailPrint "Long operation ended..." 
FunctionEnd 

Section 
DetailPrint "Simulating other install tasks..." 
Sleep 222 
Sleep 222 
Sleep 222 
Sleep 222 
Sleep 222 
Sleep 222 

; Add a image and hide the log 
FindWindow $2 "#32770" "" $HWNDPARENT ; Find inner dialog 
GetDlgItem $0 $2 0x3F8 ; Find log window 
System::Call *(i,i,i,i)i.r1 ; Allocate a RECT 
System::Call 'USER32::GetWindowRect(ir0s,ir1)' ; Also saves log HWND on stack 
ShowWindow $0 0 ; Hide log window 
System::Call '*$1(i.r4,i.r5,i.r6,i.r7)' 
IntOp $6 $6 - $4 
IntOp $7 $7 - $5 
System::Call 'USER32::ScreenToClient(ir2,ir1)' 
System::Call '*$1(i.r4,i.r5)' 
System::Free $1 
System::Call 'USER32::CreateWindowEx(i0,t"STATIC",i0,i${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_VISIBLE}|${SS_BITMAP},ir4,ir5,ir6,ir7,ir2,i0,i0,i0)i.r2' 
Push $2 ; Save HWND 
SetDetailsPrint none 
File "/oname=$pluginsdir\img.bmp" "${NSISDIR}\Contrib\Graphics\Header\orange.bmp" 
SetDetailsPrint lastused 
${NSD_SetImage} $2 "$pluginsdir\img.bmp" $9 
Push $9 ; Save HBITMAP 


!insertmacro ProgressMarquee_Begin 
Call DoLongOperation 
!insertmacro ProgressMarquee_Remove 


; Remove and cleanup image 
Pop $0 
${NSD_FreeBitmap} $0 
Pop $0 
ShowWindow $0 0 
Pop $0 ; Log window handle we saved 
ShowWindow $0 1 
SectionEnd 

如果你想顯示多個圖像,那麼你需要$ {NSD_SetImage}多個呼叫,但如果你要沿着這條路走下去它可能是更好的寫一個NSIS插件,做這一切的二級線...

+0

哇!我問他們你快回答問題!非常感謝! –

+0

有關選取框進度條的問題:它可以工作,但由於某些原因,動畫速度不是恆定的 - 有時候這是正常的,但有時候速度很快會導致閃爍。所以它會在正常速度和超快速閃爍之間循環幾次。在Windows 8.1和Windows 7上試用過它 - 結果相同。我在您之前的回答中提供的例程之前插入了ProgressMarquee_Begin宏。它可能與等待循環中的睡眠指令有關嗎? –

+0

可能的話,你可以將你的等待分成多個更短的Sleeps找出來。 – Anders