0

私は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

質問:

  1. コントロールが消える理由を誰か知っていますか?
  2. このページにコントロールを正常に追加するには、何をする必要がありますか?
4

1 に答える 1

2

MUI_UNPAGE_CONFIRM は nsDialogs ページではありません!

このダイアログを変更するには、ChangeUI コマンドを使用できます。実行時にコントロールを追加することもできますが、システム プラグインを使用する必要があります。

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
于 2013-10-30T01:47:42.207 に答える