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

Installation 为什么我的setupexe在添加2个自定义页面后崩溃?,installation,nsis,Installation,Nsis,我已经写了一个脚本,我已经添加了2个自定义页面。 我将根据某些情况跳过这些页面。但我惊讶地发现,在添加了2个自定义页面后,我的安装文件崩溃了。 请注意,我正在使用中止 当我没有跳过页面时,一切都正常工作,没有任何故障,但当我跳过第一页时,我的第二页就会使应用程序崩溃 我的自定义页面创建代码: Page custom Maintainance ContinueOrRemovePageNormal_Leave !insertmacro MUI_PAGE_WELCOME !insertmacro MU

我已经写了一个脚本,我已经添加了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作为id起诉的这两个地方。这是否是一个问题,因为这两个页面都不同。

跳过页面时,您必须在
nsDialogs::Create
之前调用


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

在两个页面上使用1018即可。您应该尝试发布复制错误的脚本的最低版本,给定的代码段可能不够。@idleberg:编辑了我的问题,请查看一下它Hanks Anders。我不知道。现在我的脚本工作正常,我们的安装程序中也有类似的问题,并发现在nsDialogs::Create之前调用Abort的另一种方法是调用Quit以干净地退出安装程序。在nsDialogs::Create和nsDialogs::Show之间调用Quit似乎是安全的。@ChrisKline:是的,Quit仅设置一个标志,该标志仅在自定义页结束后才被选中,而abort(和return)将中断函数,当插件显示自定义页时,您无法执行此操作。