简体   繁体   中英

nsis installer autoexits/ closes automatically , i am using pre and show functions to show a directory MUI page

i am building an installer using nsis. i have added 5 buttons using resource hacker on the Directory Page Dialog of the installer. also i have defined these functions:

      !define IDC_BUTTON_CDRIVEPATH         1200
      !define IDC_BUTTON_DDRIVEPATH         1201
      !define IDC_BUTTON_EDRIVEPATH         1202
      !define IDC_BUTTON_FDRIVEPATH         1203
      !define IDC_BUTTON_GDRIVEPATH         1204

!define MUI_CUSTOMFUNCTION_GUIINIT myGuiInit

  !insertmacro MUI_PAGE_WELCOME
  !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\licensefile.txt"

    !define MUI_PAGE_CUSTOMFUNCTION_PRE DirectoryPre
    !define MUI_PAGE_CUSTOMFUNCTION_SHOW DirectoryShow

      !insertmacro MUI_PAGE_DIRECTORY

      !insertmacro MUI_PAGE_COMPONENTS
      !insertmacro MUI_PAGE_INSTFILES
      !insertmacro MUI_PAGE_FINISH

Function DirectoryShow

  GetFunctionAddress $R0 DDRIVEPATH
  ButtonEvent::AddEventHandler ${IDC_BUTTON_DDRIVEPATH} $R0
FunctionEnd 

Function DirectoryPre

  GetFunctionAddress $R6 EDRIVEPATH
  ButtonEvent::AddEventHandler ${IDC_BUTTON_EDRIVEPATH} $R6

line 1--      GetFunctionAddress $R7 FDRIVEPATH
line 2--      ButtonEvent::AddEventHandler ${IDC_BUTTON_FDRIVEPATH} $R7

line 3--      GetFunctionAddress $R8 GDRIVEPATH
line 4--      ButtonEvent::AddEventHandler ${IDC_BUTTON_GDRIVEPATH} $R8

FunctionEnd

When i do not remove the two handlers FDRIVEPATH & GDRIVEPATH ,ie when i do not remove the lines--LINE 1,2,3,4, then,-------------when i goto COMPONENTS page, and press the BACK button to go back to the DIRECTORY page, then the installer exits automatically. i don't know why its happening.? please help? am stuck with it since two days.

BUT, when i remove the two handlers FDRIVEPATH & GDRIVEPATH ,ie when i remove the lines--LINE 1,2,3,4, then, the installer runs properly.

I want all the handlers for these five buttons. i dont want to remove any of them.

FOLLOWING IS MY DIRECTORY PAGE DIALOG:---------在此处输入图像描述

Use ComboBox or ListBox which will be filled with all drives letters to save space.

ComboBox created with nsDialogs:

Var CB_Buttons

${NSD_CreateComboBox} 0 20 32% 100 ""
Pop $CB_Buttons
   ${NSD_CB_AddString} $CB_Buttons "A:\" 
   ${NSD_CB_AddString} $CB_Buttons "B:\"
   ${NSD_CB_AddString} $CB_Buttons "C:\"
etc. 

THE BUTTON EVENT PLUGIN WAS HAVING A BUG, WHICH HAS BEEN FIXED BY THE PLUG-IN DEVELOPER, Mr. Afrow UK.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM