0

我正在尝试在我的安装程序中向前跳转 1 页。我的 NSIS 安装程序中有一个自定义页面。此自定义页面提示用户输入序列号。如果它们是有效的,我会将安装程序跳转到下一页(欢迎页面),否则我们会留在页面上。我将从 Initialse 和 Finalize 函数中跳到下一页。

每次我尝试跳转到下一页时,安装程​​序都会关闭。我已经尝试过AbortReturn但都导致安装程序关闭。我也尝试过Call RelGoToPagewhere $R9is1但这会将用户发回他们已经在的页面,即无限循环。

出了什么问题,我怎样才能让我的安装程序跳转到下一页。

# 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
4

1 回答 1

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
于 2014-04-24T15:12:04.593 回答