【问题标题】:button plugin not working for more than one button in MUI NSIS Installer按钮插件在 MUI NSIS 安装程序中不能用于多个按钮
【发布时间】:2011-05-03 05:26:30
【问题描述】:

在 GetButtonID 函数中,当给出多个按钮事件处理程序时,它会在显示目录 MUI 页面对话框之前自动退出。 但是,当只给出一个按钮事件处理程序时,目录页面显示没有任何问题。

!include "MUI2.nsh"

!define IDC_BUTTON_CDRIVEPATH 1200
!define IDC_BUTTON_DDRIVEPATH 1201

;---------------------------------------
;Name and file
Name Remove_ERROR
OutFile solve_error.exe
; -------------------------------

!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\setup.ico" ;
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\icon.bmp" 
!define MUI_WELCOMEFINISHPAGE_BITMAP"${NSISDIR}\Contrib\Graphics\Wizard\img.bmp" 
!define MUI_ABORTWARNING

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

!define MUI_PAGE_CUSTOMFUNCTION_SHOW GetButtonID **    <---in this function only one button event handler works, if two handlers are given , then installer crashes**

!insertmacro MUI_PAGE_DIRECTORY

!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

Function **CDRIVEPATH**
   MessageBox MB_OK|MB_ICONEXCLAMATION "The Software will be installed in : C Drive"
FunctionEnd

Function **DDRIVEPATH**
   MessageBox MB_OK|MB_ICONEXCLAMATION "The Software will be installed in : D Drive"
FunctionEnd
;--------------------------------

Function **GetButtonID** 

GetFunctionAddress $R2 CDRIVEPATH 
ButtonEvent::AddEventHandler ${IDC_BUTTON_CDRIVEPATH} $R2 

;when this second button handler is given ,then installer autoexits as soon as it has to show the Directory MUI Page dialog:

GetFunctionAddress $R3 DDRIVEPATH 
ButtonEvent::AddEventHandler ${IDC_BUTTON_DDRIVEPATH} $R3

FunctionEnd

;------------------------------------------------------------------
Section "INSTALL MAIN SOFTWARE" 

SetOutPath $INSTDIR

File /r "myfolder\*.*"

SectionEnd
;------------------------------------------------------------------

【问题讨论】:

    标签: installation plugins custom-controls nsis modern-ui


    【解决方案1】:

    此行为是由 ButtonEvent.dll 插件中的错误引起的。获取这个插件的新版本来解决它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-19
      • 2011-01-24
      • 1970-01-01
      • 2019-09-23
      • 1970-01-01
      相关资源
      最近更新 更多