将文本添加到 NSIS 安装程序的已完成对话框

Adding text to the completed dialog of an NSIS installer

我正在尝试在 NSIS 安装程序的末尾添加文本或添加额外的对话框。所以,澄清一下,当安装成功完成后,我想显示一些信息。

我看过各种涉及它的示例,但 none 似乎确实提出了解决方案。

有没有人有任何可以提供帮助的信息?

您已经在使用 MUI,因此您可以自定义完成页面文本以满足您的需要:

!include MUI2.nsh
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_TITLE "Custom title"
!define MUI_FINISHPAGE_TITLE_3LINES
!define MUI_FINISHPAGE_TEXT "Custom text blah blah blah$\r$\nblah blah blah$\r$\nblah blah blah$\r$\nblah blah blah$\r$\nblah blah blah$\r$\n"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English

如果出于某种原因无法接受,您可以创建一个完全自定义的页面:

!include MUI2.nsh
!insertmacro MUI_PAGE_INSTFILES
AutoCloseWindow True ; Automatically move on from the InstFiles page
Page Custom MyFinishPageCreate
!insertmacro MUI_LANGUAGE English

!include nsDialogs.nsh

Function MyFinishPageCreate
!ifdef MUI_SYSVERSION
!insertmacro MUI_HEADER_TEXT "Title" "Sub-title"
!endif
nsDialogs::Create 1018
Pop [=11=]
${NSD_CreateLabel} 0 0 100% 12u "Blah blah blah"
Pop [=11=]
${NSD_CreateLabel} 0 30u 100% -30u "More blah blah blah"
Pop [=11=]
nsDialogs::Show
FunctionEnd

如果您想在 InstFiles 页面上直接显示文本,您必须手动创建标签控件:

!include LogicLib.nsh
!include nsDialogs.nsh
!include WinMessages.nsh

Page InstFiles "" InstFilesShow

Var MyText
Function InstFilesShow
; Cannot use CreateWindowEx in a Section, must do it in the show callback
FindWindow  "#32770" "" $HWNDPARENT # Finds the inner dialog
System::Call 'USER32::CreateWindowEx(i${__NSD_Label_EXSTYLE},t "${__NSD_Label_CLASS}",t "Text goes here",i${__NSD_Label_STYLE},i10,i100,i300,i200,p,p0,p0,p0)p.s'
Pop $MyText
ShowWindow $MyText 0
SendMessage  ${WM_GETFONT} 0 0 
SendMessage $MyText ${WM_SETFONT}  1
FunctionEnd

Section
${IfNot} ${Abort}
    ShowWindow $MyText 1
${EndIf}
SectionEnd