简体   繁体   English

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

[英]Adding text to the completed dialog of an NSIS installer

I'm trying to add text or add an extra dialog at the end of an NSIS installer. 我正在尝试在NSIS安装程序的末尾添加文本或添加一个额外的对话框。 So, to clarify, when the install has completed successfully I want to show some information. 因此,澄清一下,安装成功完成后,我想显示一些信息。

在此处输入图片说明

I've seen various examples that touch on it but none seem to actually present a solution. 我已经看到了涉及它的各种示例,但是似乎都没有一个实际的解决方案。

Does anyone have any info that can help? 有谁能提供帮助的信息?

You are already using the MUI so you can just customize the finish page text to fit your needs: 您已经在使用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

And if that is unacceptable for whatever reason, you can create a totally custom page: 如果由于某种原因这是不可接受的,则可以创建一个完全自定义的页面:

!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 $0
${NSD_CreateLabel} 0 0 100% 12u "Blah blah blah"
Pop $0
${NSD_CreateLabel} 0 30u 100% -30u "More blah blah blah"
Pop $0
nsDialogs::Show
FunctionEnd

If you want to display text directly on the InstFiles page you have to create a label control manually: 如果要直接在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 $1 "#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$1,p0,p0,p0)p.s'
Pop $MyText
ShowWindow $MyText 0
SendMessage $1 ${WM_GETFONT} 0 0 $2
SendMessage $MyText ${WM_SETFONT} $2 1
FunctionEnd

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM