我使用MUI_PAGE_INSTFILES。这个页面通常有一个完成按钮,但是我在它之后有一个自定义页面。但是我希望您仍然可以在自定义页面之前完成安装程序,并且下一页只能是可选的。如果愿意,我也可以显示更多的代码。
!include "MUI2.nsh"
!insertmacro MUI_PAGE_LICENSE $(license)
!insertmacro MUI_PAGE_INSTFILES
Page custom TestSettings目前,我在instfile页面上有一个“前”、“下一个”和“取消”按钮。但我想要一个预科,下一个-和完成-按钮。
发布于 2019-07-20 13:59:16
NSIS从来都不是为了支持这一点而设计的,但是有了ButtonEvent插件,你就可以让它发挥作用。我只是不确定这是否有意义,因为如果最后一页很重要,那么一些用户可能会不小心跳过页面,因为他们没有注意到。
!include MUI2.nsh
!insertmacro MUI_PAGE_LICENSE $(license)
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE InstFilesLeave
!insertmacro MUI_PAGE_INSTFILES
Page custom TestSettings
!insertmacro MUI_LANGUAGE English
!include WinMessages.nsh
!include nsDialogs.nsh
Function InstFilesLeave
GetDlgItem $0 $hWndParent 2
ShowWindow $0 0
System::Call 'USER32::GetWindowRect(pr0,@r1)' ; NSIS 3+
System::Call 'USER32::MapWindowPoints(p0,p $hWndParent, p $1, i 2)'
System::Call '*$1(i.r2,i.r3,i.r4,i.r5)'
IntOp $4 $4 - $2
IntOp $5 $5 - $3
!define IDC_MYFINISHBTN 1337
System::Call 'USER32::CreateWindowEx(i 0, t "BUTTON", t "&Finish", i ${DEFAULT_STYLES}|${WS_TABSTOP}, ir2, ir3, i r4, i r5, p $hWndParent, p ${IDC_MYFINISHBTN}, p 0, p 0)p.r1'
SendMessage $0 ${WM_GETFONT} "" "" $0
SendMessage $1 ${WM_SETFONT} $0 1
GetFunctionAddress $0 OnFinishButton
ButtonEvent::AddEventHandler ${IDC_MYFINISHBTN} $0
FunctionEnd
Var JustFinish
Function OnFinishButton
StrCpy $JustFinish 1
SendMessage $hWndParent ${WM_COMMAND} 1 ""
FunctionEnd
Function TestSettings
StrCmp $JustFinish "" +2
Return
GetDlgItem $0 $hWndParent ${IDC_MYFINISHBTN}
ShowWindow $0 0
GetDlgItem $0 $hWndParent 2
ShowWindow $0 1
!insertmacro MUI_HEADER_TEXT "Configure" "Blah blah blah"
nsDialogs::Create 1018
Pop $0
; ...
nsDialogs::Show
FunctionEnd如果您的自定义页面只包含两个复选框,那么您可以选择使用带有自定义文本的MUI完成页。
https://stackoverflow.com/questions/57112174
复制相似问题