我正试图在我的安装程序中向前跳转1页。我的NSIS安装程序中有一个自定义页面。此自定义页面提示用户输入序列号。如果它们有效,我会将安装程序跳转到下一页(欢迎页面),如果不是我们仍然在页面上。 我将从Initialse和Finalize函数中跳转到下一页。
每当我尝试跳转到下一页时,安装程序就会关闭。我尝试了Abort
和Return
但都导致安装程序关闭。我还将Call RelGoToPage
$R9
放在1
# Page Definition
Page Custom SerialPageInitialise SerialPageFinalise
# Page Implementation
Function SerialPageInitialise
!insertmacro ValidateSUser
${If} $isValidUser > 0 # If user if valid
Return # Go to next page...Doesn't work just closes the whole installer
#Abort # Doesn't work just closes the whole installer
${EndIf}
FunctionEnd
# For the following function: the message "A" always shows then the installer closes
Function SerialPageFinalise
${NSD_GetText} $SerialEditBx $R9
!insertmacro ValidateUserExpanded "$R9"
${If} $isValidUser > 0 # If user if valid
MessageBox MB_OK "A"
${Else}
MessageBox MB_OK|MB_ICONEXCLAMATION "Authentication Failed. You are not a recognised client."
Abort
${EndIf}
FunctionEnd
,但这会向用户发回他们已经在的页面,即无限循环。
出了什么问题,如何让我的安装程序跳转到下一页。
{{1}}
答案 0 :(得分:0)
对我来说很好:
!include LogicLib.nsh
!include nsDialogs.nsh
var isValidUser
var SerialEditBx
!macro ValidateUserExpanded param
StrCpy $isValidUser 0
${If} ${param} = 666
StrCpy $isValidUser 1
${EndIf}
!macroend
!macro ValidateSUser
MessageBox mb_yesno "ValidateSUser?" IDNO nope
!insertmacro ValidateUserExpanded 666
nope:
!macroend
Function SerialPageInitialise
!insertmacro ValidateSUser
${If} $isValidUser > 0
Abort ; Skip page
${EndIf}
nsDialogs::Create 1018
Pop $0
${NSD_CreateText} 0 13u 50% 13u "667"
Pop $SerialEditBx
nsDialogs::Show
FunctionEnd
Function SerialPageFinalise
${NSD_GetText} $SerialEditBx $R9
!insertmacro ValidateUserExpanded "$R9"
${If} $isValidUser > 0 # If user if valid
MessageBox MB_OK "OK"
${Else}
MessageBox MB_OK|MB_ICONEXCLAMATION "Authentication Failed. You are not a recognised client."
Abort ; Don't allow going to next page
${EndIf}
FunctionEnd
Page Custom SerialPageInitialise SerialPageFinalise
Page InstFiles