2014-04-23 105 views
0

我想在我的安裝程序中跳轉1頁。我在我的NSIS安裝程序中有一個自定義頁面。該自定義頁面提示用戶輸入序列號。如果它們有效,我會將安裝程序轉到下一頁(歡迎頁面),如果不是,我們將保留在頁面上。 我將從Initialse和Finalize函數中跳到下一頁。跳轉到下一頁

每當我嘗試跳到下一頁時,安裝程​​序就會關閉。我試過AbortReturn,但都導致安裝程序關閉。我也有很多Call RelGoToPage,其中$R91,但這會將用戶發回他們已經在的頁面,即無限循環。

怎麼回事,我該如何讓我的安裝程序跳轉到下一頁。

# 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 
+0

您例如只有一個頁面,在那裏它應該跳? – Anders

回答

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