簡體   English   中英

NSIS如何在安裝過程中修改MUI_PAGE_INSTFILES?

[英]NSIS How to modify MUI_PAGE_INSTFILES during installtion?

我想知道是否可以在MUI_PAGE_INSTFILES頁上運行安裝時執行以下UI修改/調整(以編程方式在nsi腳本中進行):

  1. 將進度條的樣式設置為marque(連續“滾動”)

  2. 隱藏詳細信息文本字段(在其中顯示進度文本),並顯示預定義的圖片(包含在安裝程序中)

[編輯]對於數字2,也可以縮小細節字段,並在其下方將其顯示為橫幅之類的標簽(這樣,細節字段將僅在垂直方向上占據一半的空間,而在其下方的另一半將被圖片-這樣用戶可以同時看到進度和“橫幅”)。

[編輯]更好的方法是進行一些基本的幻燈片放映:定義幾張圖片並每10秒旋轉一次

我想要的示例圖形

其背后的想法是,在安裝的某些部分中,可能需要一些時間(例如,超過10秒)來顯示對用戶而言更有價值的信息/價值,例如如何開始圖形化,促銷或其他方式。

如何才能做到這一點?

謝謝。

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插件...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM