Installation NSIS:如何完成-和下一个按钮?

Installation NSIS:如何完成-和下一个按钮?,installation,nsis,nsis-mui,Installation,Nsis,Nsis Mui,我使用MUI\u页面\u INSTFILES。这个页面通常有一个finish按钮,但后面有一个自定义页面。但是我希望您仍然可以在自定义页面之前完成安装程序,并且下一页只是可选的。如果愿意,我还可以显示更多代码 !include "MUI2.nsh" !insertmacro MUI_PAGE_LICENSE $(license) !insertmacro MUI_PAGE_INSTFILES Page custom TestSettings 目前,我在instfile页面上有一个“上一步”、

我使用
MUI\u页面\u INSTFILES
。这个页面通常有一个finish按钮,但后面有一个自定义页面。但是我希望您仍然可以在自定义页面之前完成安装程序,并且下一页只是可选的。如果愿意,我还可以显示更多代码

!include "MUI2.nsh"

!insertmacro MUI_PAGE_LICENSE $(license)
!insertmacro MUI_PAGE_INSTFILES
Page custom TestSettings

目前,我在instfile页面上有一个“上一步”、“下一步”和“取消”按钮。但我想要一个“上一步”、“下一步”和“完成”按钮。

NSIS从来并没有设计过支持这个按钮,但有了它,你们就可以让它工作了。我只是不确定这是否有意义,因为如果最后一页很重要,那么一些用户可能会因为没有注意而意外跳过该页

!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
如果您的自定义页面只包含几个复选框,那么您可以改为