Вопрос

I've done some research on customizing NSIS uninstaller pages and had some success with the Welcome and Finish pages.

However I'm having trouble using the same template as I did on the Welcome page with the Confirm page. If I add any control using nsDialogs with a non-zero height value, all of the existing controls (apart from the header and the buttons) on the Confirm page disappear.

Here is my code (it successfully updates the button name but will remove all other controls on that page)

!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

Questions:

  1. Does anyone know why the controls disappear?
  2. What do I need to do to successfully add a control to this page?
Это было полезно?

Решение

MUI_UNPAGE_CONFIRM is not a nsDialogs page!

To change this dialog you can use the ChangeUI command. You can also add controls at runtime but only by using the system plugin:

Function un.ModifyUnConfirm
    FindWindow $1 "#32770" "" $HWNDPARENT ; Find inner dialog
    System::Call 'USER32::CreateWindowEx(i${__NSD_Label_EXSTYLE},t"${__NSD_Label_CLASS}",t "Testing!!!",i${__NSD_Label_STYLE},i 50,i 100,i 400, i 25,i$1,i0,i0,i0)i.s'
    Pop $0
    SendMessage $HWNDPARENT ${WM_GETFONT} 0 0 $1
    SendMessage $0 ${WM_SETFONT} $1 1
    SetCtlColors $0 "" ${MUI_BGCOLOR} ; This is the wrong color to use...
FunctionEnd
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top