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

问题描述 投票:0回答:1

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

enter image description here

我已经看到了触及它的各种示例,但似乎没有一个实际提供解决方案。

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

installer nsis
1个回答
1
投票

您已经在使用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 $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

如果要直接在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
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.