Вопрос

I have written a script where I have added 2 custom pages. I am skipping these pages depending on some condition.But I am surprised to see that my setup file is crashing after addition of 2 custom pages . Note-To skip I am using abort and when i am not skipping the page than everything is working without any glitches but when i am skipping the 1st page then my second page is crashing the applicatipon

My custom pages creation code :

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

Both the places i am suing 1018 as id .Is it a problem as both the pages are different .

Это было полезно?

Решение

When skipping a page you must call abort before nsDialogs::Create!

If nsDialogs::Create succeeded you have to call nsDialogs::Show because the page has already been partially created.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top