簡體   English   中英

按鈕插件在 MUI NSIS 安裝程序中不能用於多個按鈕

[英]button plugin not working for more than one button in MUI NSIS Installer

在 GetButtonID function 中,當給出多個按鈕事件處理程序時,它會在顯示目錄 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
;------------------------------------------------------------------

在此處輸入圖像描述

此行為是由 ButtonEvent.dll 插件中的錯誤引起的。 獲取這個插件的新版本來解決它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM