使用 MUI2 for NSIS 时如何修改 MUI_WELCOME_PAGE 中的文本?

发布于 2024-10-23 19:52:44 字数 373 浏览 1 评论 0原文

我想在我使用 NSIS 和 MUI2 创建的安装程序的欢迎屏幕中添加一个显示完整版本字符串的标签。

我搜索了有关如何执行此操作的信息,但只找到了有关使用 MUI_INSTALLOPTIONS* 的参考,我发现 MUI2 已弃用该参考。另一位提到使用 INSTALLOPTIONS* 的新版本具有相同的选项,但我无法让它工作。我最终还找到了使用 nsDialogs 的参考 - 这就是我在自定义页面中使用的内容。但是 - 我没有找到有关如何更改 MUI2.nsh 附带的任何现有页面的参考或示例。

我找到了一种更改 MUI_HEADERTEXT 的方法,但这不会影响欢迎屏幕。我希望有一种方法也可以更改欢迎文本。也许使用 MUI_WELCOMETITLE 和 MUI_WELCOMEBODY 或类似的。

I want to add a label displaying the full version-string in the welcome screen in the installer I am creating using NSIS with MUI2.

I have searched for info on how to do this, but only found references to using MUI_INSTALLOPTIONS* which I found ws deprecated for MUI2. Another one referred to the newer versions using INSTALLOPTIONS* with the same options, but I could not get it working. I finally also found a reference to using nsDialogs for this - which is what I am using for my custom pages. However - I found no reference or samples on how to change any of the existing pages that comes with MUI2.nsh.

I found a way to change the MUI_HEADERTEXT, but that doesn't affect the welcome-screen. I wish there was a way to also change the welcometext. Maybe using MUI_WELCOMETITLE and MUI_WELCOMEBODY or similar.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酒解孤独 2024-10-30 19:52:44

有 MUI_WELCOMEPAGE_TEXT 但只有当您想要更改所有文本而不仅仅是附加某些内容时它才有用。

在页面的显示功能期间,您可以更改任何控件的文本:

outfile test.exe
requestexecutionlevel user

!include MUI2.nsh

#!define MUI_WELCOMEPAGE_TEXT "New text goes here"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyWelcomeShowCallback
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"


Function MyWelcomeShowCallback
SendMessage $mui.WelcomePage.Text ${WM_SETTEXT} 0 "STR:$(MUI_TEXT_WELCOME_INFO_TEXT)$\n$\nVersion: foo.bar"
FunctionEnd

Section
SectionEnd

..或添加新控件:

outfile test.exe
requestexecutionlevel user

!include MUI2.nsh

!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyWelcomeShowCallback
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"


Function MyWelcomeShowCallback
${NSD_CreateLabel} 120u 150u 50% 12u "Version: foo.bar"
Pop $0
SetCtlColors $0 "" "${MUI_BGCOLOR}"
FunctionEnd

Section
SectionEnd

There is MUI_WELCOMEPAGE_TEXT but it is only useful if you want to change all of the text and not just append something.

During the show function for the page, you can change the text of any control:

outfile test.exe
requestexecutionlevel user

!include MUI2.nsh

#!define MUI_WELCOMEPAGE_TEXT "New text goes here"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyWelcomeShowCallback
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"


Function MyWelcomeShowCallback
SendMessage $mui.WelcomePage.Text ${WM_SETTEXT} 0 "STR:$(MUI_TEXT_WELCOME_INFO_TEXT)$\n$\nVersion: foo.bar"
FunctionEnd

Section
SectionEnd

..or add a new control:

outfile test.exe
requestexecutionlevel user

!include MUI2.nsh

!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyWelcomeShowCallback
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"


Function MyWelcomeShowCallback
${NSD_CreateLabel} 120u 150u 50% 12u "Version: foo.bar"
Pop $0
SetCtlColors $0 "" "${MUI_BGCOLOR}"
FunctionEnd

Section
SectionEnd
深者入戏 2024-10-30 19:52:44

我也遇到过 NSIS 的问题。就我而言,它可以在插入宏 MUI_PAGE_WELCOME 之前定义 MUI_WELCOMEPAGE_TITLE。

它应该看起来像:

!define MUI_WELCOMEPAGE_TITLE  "CUSTOM TITLE HERE"
!insertmacro MUI_PAGE_WELCOME

I also had the issue with NSIS. In my case it worked to define MUI_WELCOMEPAGE_TITLE before inserting the macro MUI_PAGE_WELCOME.

It should look like:

!define MUI_WELCOMEPAGE_TITLE  "CUSTOM TITLE HERE"
!insertmacro MUI_PAGE_WELCOME
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文