简体   繁体   中英

Use 2 welcome/finish page images in nsis

I am using this code to change the MUI_WELCOMEFINISH_BITMAP , text and title of the welcome page.

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

  !define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\bg2_2.bmp"
  !insertmacro MUI_PAGE_WELCOME

  !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
  !insertmacro MUI_PAGE_COMPONENTS
  !insertmacro MUI_PAGE_DIRECTORY

  !define MUI_WELCOMEPAGE_TITLE "Title"
  !define MUI_WELCOMEPAGE_TEXT  "Text"
  !define MUI_PAGE_CUSTOMFUNCTION_SHOW MyWelcomeShowCallback
  !insertmacro MUI_PAGE_WELCOME

  !insertmacro MUI_PAGE_INSTFILES
  !insertmacro MUI_PAGE_FINISH

I wanted to change the bitmap twice, once for welcome and once for finish page. Unfortunately !define MUI_WELCOMEFINISHPAGE_BITMAP $bmp can only be used once. I know that it is possible to change bmp path in Welcome.nsh , but I'd rather define everything in .nsi script. How can I set differ.net images for welcome and finish page? In essence, how does one change the value if !defined was used to create it.

There is no define you can set to use different images but you can overwrite the image before the page is displayed:

Function ForceWizard1
SetOverWrite on
File "/oname=$PLUGINSDIR\modern-wizard.bmp" "${NSISDIR}\Contrib\Graphics\Wizard\llama.bmp"
SetOverWrite lastused
FunctionEnd
Function ForceWizard2
SetOverWrite on
File "/oname=$PLUGINSDIR\modern-wizard.bmp" "${NSISDIR}\Contrib\Graphics\Wizard\orange-nsis.bmp"
SetOverWrite lastused
FunctionEnd

!include MUI2.nsh
!define MUI_PAGE_CUSTOMFUNCTION_PRE ForceWizard1
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!define MUI_PAGE_CUSTOMFUNCTION_PRE ForceWizard2
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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