2
votes

I am using NSIS to create an installer. How can I change the header image (MUI_HEADERIMAGE_BITMAP) based on the users language selection at install?

1
Can you put an explanation of what you have already tired? - Iain
The last thing I tried was calling GetDlgItem $mui.Header.Image in the .onInit but I don't know how to include the other image in the installer package. Forgive me if I am not using the correct terminology. I'm new to NSIS. - user1827055
No HWNDs are valid in .onInit... - Anders

1 Answers

1
votes
!define MUI_HEADERIMAGE
!define MUI_CUSTOMFUNCTION_GUIINIT myGuiInit
!include MUI2.nsh
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
...
!insertmacro MUI_LANGUAGE English
!insertmacro MUI_LANGUAGE Swedish

Function .onInit
    !insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

Function myGUIInit
    InitPluginsDir
    ${If} ${LANG_ENGLISH} = $Language
        File "/oname=$PluginsDir\langspecifichdr.bmp" "${NSISDIR}\Contrib\Graphics\Header\orange.bmp"
    ${Else}
        File "/oname=$PluginsDir\langspecifichdr.bmp" "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
    ${EndIf}
    SetBrandingImage /IMGID=1046 "$PluginsDir\langspecifichdr.bmp"
FunctionEnd