如果用户单击许可证页面NSIS上的“取消",则显示完成页面 [英] Show finish page if user click cancel on license page NSIS
问题描述
我有两个许可证页面,在第二个许可证页面中,如果用户选择不安装第三方应用程序,则会显示完成页面.到目前为止,我使用MUI_CUSTOMFUNCTION_ABORT onUserAbort
进入完成页面.
I have two license page and in the second license page, if user choose not to install the 3rd party app, it will show finish page. So far I use MUI_CUSTOMFUNCTION_ABORT onUserAbort
to move into finish page.
但是问题是当用户单击跳过"按钮(实际上是取消"按钮,我将其重命名为跳过")时,它将停留在许可证页面上,并且安装"按钮变为下一步"按钮(图像1->图像2->图像3 ).我知道发生这种情况是因为我在onUserAbort
中调用了Abort
.如果我不打Abort
,则当用户单击跳过"时,窗口将自动关闭.
But the problem is when user click Skip button (it's actually Cancel button and I rename it into Skip), it will stay on license page and the Install button change to Next button (image 1 -> image 2 -> image 3). I know this is happen because I call Abort
in onUserAbort
. If I don't call Abort
, then the window will automatically close when user click Skip.
您知道如何直接转到完成页面吗? (图片1->图片3,没有图片2)
Do you have any idea how to directly move to finish page? (image 1 -> image 3, without image 2)
!insertmacro MUI_PAGE_WELCOME
page custom CheckHWSpecs ShowNotMeetRequirementDialog
!insertmacro MUI_PAGE_LICENSE "${SOURCEFOLDER}\license1.txt"
!define MUI_DIRECTORYPAGE_VERIFYONLEAVE
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!define MUI_LICENSEPAGE_CHECKBOX
!define MUI_PAGE_CUSTOMFUNCTION_PRE Lic2Pre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW Lic2Show
!insertmacro MUI_PAGE_LICENSE "${SOURCEFOLDER}\license2.txt"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!define MUI_CUSTOMFUNCTION_ABORT onUserAbort
!insertmacro MUI_LANGUAGE English
Lic2Pre上的代码:
The code on Lic2Pre:
Function Lic2Pre
StrCpy $R8 2
FunctionEnd
Lic2Show上的代码:
The code on Lic2Show:
Function Lic2Show
GetDlgItem $0 $hwndparent 2
SendMessage $0 ${WM_SETTEXT} 0 "STR:Skip"
!insertmacro SelectSection ${SEC0013}
!insertmacro UnselectSection ${SEC0000}
!insertmacro UnselectSection ${SEC0002}
!insertmacro UnselectSection ${SEC0003}
!insertmacro UnselectSection ${SEC0004}
!insertmacro UnselectSection ${SEC0005}
!insertmacro UnselectSection ${SEC0007}
!insertmacro UnselectSection ${SEC0010}
!insertmacro UnselectSection ${SEC0011}
!insertmacro UnselectSection ${SEC0012}
FunctionEnd
进入特定页面的代码:
Function RelGotoPage
IntCmp $R9 0 0 Move Move
StrCmp $R9 "X" 0 Move
StrCpy $R9 "120"
Move:
SendMessage $HWNDPARENT "0x408" "$R9" ""
FunctionEnd
用户中止时的自定义功能:
The custom function on user abort:
Function onUserAbort
StrCmp $R8 2 0 End
StrCpy $R9 2
Call RelGotoPage
Abort
End:
FunctionEnd
推荐答案
!include Sections.nsh
!include WinMessages.nsh
ShowInstDetails show
!define MUI_CUSTOMFUNCTION_ABORT onUserAbort
!include MUI2.nsh
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Examples\example1.nsi"
!insertmacro MUI_PAGE_INSTFILES
!define MUI_LICENSEPAGE_CHECKBOX
!define MUI_LICENSEPAGE_CHECKBOX_TEXT "Blah blah blah app and agree..."
!define MUI_PAGE_CUSTOMFUNCTION_SHOW Lic2Show
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE Lic2Leave
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Examples\example2.nsi"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English
Section /o "Bonus app" SID_BONUS
DetailPrint "Installing bonus app..."
Sleep 2222
SectionEnd
Section "Main app" SID_MAIN
DetailPrint "Installing main app..."
Sleep 2222
SectionEnd
var installBonus
Function Lic2Show
StrCpy $installBonus 1
GetDlgItem $0 $hwndparent 2
SendMessage $0 ${WM_SETTEXT} 0 "STR:&Skip"
!insertmacro UnselectSection ${SID_MAIN} ; Already installed, uncheck
FunctionEnd
Function Lic2Leave
${If} $installBonus == 1
!insertmacro SelectSection ${SID_BONUS}
${EndIf}
FunctionEnd
Function onUserAbort
${If} $installBonus == 1
StrCpy $installBonus 0
System::Call 'USER32::PostMessage(i$HWNDPARENT,i0x408,i 1,i0)' ; Delayed skip 1 page
Abort
${EndIf}
FunctionEnd
这篇关于如果用户单击许可证页面NSIS上的“取消",则显示完成页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!