为什么我的setupexe在添加2个自定义页面后崩溃了?

时间:2014-02-24 10:21:42

标签: installation nsis

我编写了一个脚本,其中添加了2个自定义页面。 我正在根据某些条件跳过这些页面。但是我很惊讶地看到我的安装文件在添加2个自定义页面后崩溃了。 注意 - 要跳过我正在使用中止 当我没有跳过页面而不是一切都没有任何故障,但当我跳过第一页然后我的第二页崩溃应用程序

我的自定义页面创建代码:

Page custom Maintainance ContinueOrRemovePageNormal_Leave
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro UMUI_PAGE_ALTERNATIVESTARTMENU Application $StartMenuFolder 
!insertmacro MUI_PAGE_INSTFILES
Page custom FindFtdiPage
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_RESERVEFILE_LANGDLL




Function Maintainance 
nsDialogs::Create 1018
    Pop $Dialog
    ${If} $Dialog == error
        Abort
    ${EndIf}
    ${If} $Message == ""
        Abort
    ${EndIf}


 FindWindow $3 "#32770" "" $HWNDPARENT ; Find inner dialog
  SetCtlColors $3 "" ${MUI_BGCOLOR} 

    ${NSD_CreateLabel} 10 2 100% 25u "Welcome to the IREC  setup maintenance program"
    Pop $Maintenanceheader
    CreateFont $0 "Arial" "12" "600"
  SendMessage $Maintenanceheader ${WM_SETFONT} $0 4
     SetCtlColors $Maintenanceheader "" ${MUI_BGCOLOR} 


    ${NSD_CreateLabel} 10 70 300u 25u "$Message"
    Pop $Label
    CreateFont $0 "Arial" "9" ""
    SendMessage $Label ${WM_SETFONT} $0 4
     SetCtlColors $Label "" ${MUI_BGCOLOR} 
   ${NSD_CreateRadioButton} 40 80u 100% 10u "Uninstall V$versionfound"
Pop $2
  ${NSD_CreateRadioButton} 40 85u 100% 30u "Continue Installation of V${VERSION}"
Pop $1
CreateFont $0 "Arial" "10" "600"
  SendMessage $1 ${WM_SETFONT} $0 4
SetCtlColors $1 "" ${MUI_BGCOLOR} 
SendMessage $HWNDPARENT ${WM_NEXTDLGCTL} $0 1




  SendMessage $2 ${WM_SETFONT} $0 4
SetCtlColors $2 "" ${MUI_BGCOLOR}   
SendMessage $1 ${BM_CLICK} 0 0 ; Select one of them by default
    nsDialogs::Show


FunctionEnd

2nd custom function:
Function FindFtdipage

  MessageBox MB_YESNO "Skip custom page?" 

    nsDialogs::Create 1018
    Pop $Dialog
    ${If} $Dialog == error
        Abort
    ${EndIf}


    ${NSD_CreateLabel} 0 0 100% 12u "The complete installation folder is available at the below link"
    Pop $Label

     ${NSD_CreateLink} 0 14u 100% 12u "$INSTDIR\FTDI"
    Pop $link 
    ${NSD_OnClick} $link openlink

    ${NSD_CreateLabel} 0 42u 100% 12u "1)Install the driver for USB port" 

   Pop $Label
    ${NSD_CreateLabel} 0 56u 100% 12u "2)COM to SPI converter"
    Pop $Label



  nsDialogs::Show
  !insertmacro MUI_HEADER_TEXT "DETAIL STEPS TO INSTALL FTDI DRIVERS" " " 

FTDI:
FunctionEnd

我起诉1018的地方都是身份证明。这是一个问题,因为两个页面都不同。

1 个答案:

答案 0 :(得分:1)

跳过页面时,您必须先致电abort nsDialogs::Create

如果nsDialogs::Create成功,则必须致电nsDialogs::Show,因为该页面已部分创建。