How can I modify the text in the MUI_WELCOME_PAGE when using MUI2 for NSIS?

前端 未结 1 1351
旧巷少年郎
旧巷少年郎 2020-12-15 22:29

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 t

相关标签:
1条回答
  • 2020-12-15 23:10

    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
    
    0 讨论(0)
提交回复
热议问题