installation - nsis 安装程序自动退出/关闭,我正在使用 pre 和 show 函数来显示目录 MUI 页面

标签 installation crash custom-controls nsis modern-ui

我正在使用 nsis 构建安装程序。我使用资源黑客在安装程序的目录页面对话框中添加了 5 个按钮。我还定义了这些函数:

      !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
<小时/>

当我不删除两个处理程序FDRIVEPATHGDRIVEPATH时,即当我不删除行 1,2,3,4 时,然后,-------------当我转到组件页面,然后按“返回”按钮返回目录时页面,然后安装程序自动退出。我不知道为什么会这样。?请帮忙?我已经坚持了两天了。

但是,当我删除两个处理程序 FDRIVEPATHGDRIVEPATH 时,即当我删除行--LINE 1,2,3,4,然后,安装程序正常运行。

我想要这五个按钮的所有处理程序。我不想删除其中任何一个。

以下是我的目录页面对话框:--------- enter image description here

最佳答案

使用组合框或列表框,它们将填充所有驱动器号以节省空间。

使用 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. 

关于installation - nsis 安装程序自动退出/关闭,我正在使用 pre 和 show 函数来显示目录 MUI 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5868189/

相关文章:

node.js - 在哪里安装gulp?

javascript - UWP javascript 崩溃

wpf - 依赖属性继承

c# - Winform自定义列表框项目

java - 在 Java 中使用 Hadoop

python - 安装位数组时出错。编译器错误?

android - 为什么这个Android应用程序立即崩溃?

c# - Windows 应用程序已停止工作

c# - 如何绘制控件的圆形凸起和凹陷边缘?

linux - 更改 Pecl 安装目录