使用MUI2 for NSIS时,如何修改MUI_WELCOME_PAGE中的文本? [英] How can I modify the text in the MUI_WELCOME_PAGE when using MUI2 for NSIS?
问题描述
我想在正在使用NSIS和MUI2创建的安装程序的欢迎屏幕中添加一个显示完整版本字符串的标签.
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.
我已经搜索了有关如何执行此操作的信息,但只找到了使用MUI_INSTALLOPTIONS *的引用,而我发现该MUI2不推荐使用.另一个人使用具有相同选项的INSTALLOPTIONS *引用了较新的版本,但我无法使其正常运行.我终于也找到了使用nsDialogs的参考-这就是我用于自定义页面的内容.但是-我没有找到关于如何更改MUI2.nsh随附的任何现有页面的参考或示例.
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.
我找到了一种更改MUI_HEADERTEXT的方法,但这并不影响欢迎屏幕.我希望有一种方法也可以更改欢迎文本.也许使用MUI_WELCOMETITLE和MUI_WELCOMEBODY或类似的工具.
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.
推荐答案
有MUI_WELCOMEPAGE_TEXT,但仅在您要更改所有文本而不仅仅是附加某些内容时才有用.
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
..或添加新控件:
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
这篇关于使用MUI2 for NSIS时,如何修改MUI_WELCOME_PAGE中的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!