我对自定义 NSIS 卸载程序页面进行了一些研究,并在欢迎和完成页面方面取得了一些成功。
但是,我在使用与欢迎页面和确认页面相同的模板时遇到了问题。如果我使用具有非零值的nsDialogs 添加任何控件height
,则确认页面上的所有现有控件(除了标题和按钮)都会消失。
这是我的代码(它成功更新了按钮名称,但会删除该页面上的所有其他控件)
!include MUI2.nsh
OutFile "CustomUninstaller.exe"
InstallDir "C:\Program Files (x86)\NSIS\Examples\CustomFinish"
!define APPNAME "Testing"
Name "${APPNAME}"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_SHOW un.ModifyUnConfirm ; My custom function for the Confirm page
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
Function un.ModifyUnConfirm
# Change "Uninstall" button to say "Continue" on uninstaller confirmation page
GetDlgItem $0 $HWNDPARENT 1
SendMessage $0 ${WM_SETTEXT} 0 "STR:Continue"
# Add new label. If these three lines are commented out, I see the regular controls of this page show up.
# The position, color and background of the label don't seem to matter
${NSD_CreateLabel} 50% 50% 100% 10u "Testing!!!"
Pop $0
SetCtlColors $0 "" ${MUI_BGCOLOR}
FunctionEnd
Section TestUninstaller
WriteUninstaller "$INSTDIR\unCustomUninstaller.exe"
ExecWait "$INSTDIR\unCustomUninstaller.exe"
Sectionend
问题:
- 有谁知道为什么控件消失?
- 我需要做什么才能成功地将控件添加到此页面?