简体   繁体   English

NSIS如何在安装过程中修改MUI_PAGE_INSTFILES?

[英]NSIS How to modify MUI_PAGE_INSTFILES during installtion?

I am wondering if it will be possible to perform the following UI modifications / tweaks (programmatically in the nsi script) WHILE the installation is running on the MUI_PAGE_INSTFILES page: 我想知道是否可以在MUI_PAGE_INSTFILES页上运行安装时执行以下UI修改/调整(以编程方式在nsi脚本中进行):

  1. Set the style of the progress bar to marque (continuous "scrolling") 将进度条的样式设置为marque(连续“滚动”)

  2. Hide the details text field (where the progress text is displayed) and show a predefined picture instead (that was included with the setup) 隐藏详细信息文本字段(在其中显示进度文本),并显示预定义的图片(包含在安装程序中)

[EDIT] Alternatively for number 2: maybe shrink the details field, and display the picture as a banner like label just below it (so that the details field would occupy only half the space vertically, and the other half below it would be used by the picture - that way a user can see both the progress and the "banner"). [编辑]对于数字2,也可以缩小细节字段,并在其下方将其显示为横幅之类的标签(这样,细节字段将仅在垂直方向上占据一半的空间,而在其下方的另一半将被图片-这样用户可以同时看到进度和“横幅”)。

[EDIT] Even better still would be to have some sort of basic slide show: define several pictures and rotate them every 10 seconds [编辑]更好的方法是进行一些基本的幻灯片放映:定义几张图片并每10秒旋转一次

我想要的示例图形

The idea behind this is that during parts of the installation that may take some time (say over 10 seconds) to display something more informative / valuable to the user, such as how to get started graphic, a sales promotion or something else. 其背后的想法是,在安装的某些部分中,可能需要一些时间(例如,超过10秒)来显示对用户而言更有价值的信息/价值,例如如何开始图形化,促销或其他方式。

How can this be done? 如何才能做到这一点?

Thanks. 谢谢。

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

If you want to show multiple images then you need multiple calls to ${NSD_SetImage} but if you want to go down this route it is probably much better to write a NSIS plugin that does all this on a secondary thread... 如果要显示多个图像,则需要多次调用$ {NSD_SetImage},但是如果您想沿这条路线走,最好编写一个在辅助线程上完成所有这些工作的NSIS插件...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何跳过NSIS“组件”页面? - How can I skip the NSIS “components” page? NSIS安装程序的“许可证”页面仅显示“关闭”和“取消”按钮 - NSIS installer License page only shows “Close” and “Cancel” buttons NSIS,点击后如何在文本控件上保留标签? - NSIS, how to keep a label over a text control after it is clicked? 在NSIS中,如何在运行时将onClick事件应用于对话框控件? - In NSIS, how to apply a onClick event on a dialog control at runtime? 在NSIS中,如何在使用nsDialogs :: Create 1018时设置对话框的大小? - In NSIS, How to set the size of the dialog box when using nsDialogs::Create 1018? 如何将复选图标添加到选定的 MUI React ToggleButton? - how to add check icon to selected MUI React ToggleButton? 在自定义用户界面中找不到IDOK(1)! 如何在NSIS中添加自定义“确定”按钮? - Can't find IDOK (1) in the custom UI! How to add a custom OK Button in NSIS? 如何修改imperia cms用户界面? - How to modify the imperia cms user interface? 如何使用“销毁”属性/功能修改此 class? - How to modify this class with a "destroy" attribute/function? 如何在 java 中使用 jframe 修改 txt 文件 - How to modify a txt file using jframe in java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM