Hello.
Is there any way to completely remove header image field? Not just an image whole field where it is placed?
Actually what I need is to set different images to the header in a few custom page and for now I didn't find a way to do this without SetBrandingImage. But SetBrandingImage places image over the header, right? How can I do you nicer?
Thanks.
Remove header image
11 posts
If you are using MUI2, open this file and edit: "\NSIS\Contrib\Modern UI 2\Interface.nsh" lines code follow:
;--------------------------------
;Initialization of GUI
!macro MUI_HEADERIMAGE_INITHELPER_LOADIMAGEWITHMACRO MACRO
!ifdef MUI_HEADERIMAGE_RIGHT
!ifndef MUI_OPTIMIZE_ALWAYSLTR ; Undocumented
${if} $(^RTL) == 1
!insertmacro ${MACRO} $mui.Header.Image "${PATH}" Left Leak
${Else}
!insertmacro ${MACRO} $mui.Header.Image "${PATH}" Right Leak
${EndIf}
!else
!insertmacro ${MACRO} $mui.Header.Image "${PATH}" Right Leak
!endif
!else
!insertmacro ${MACRO} $mui.Header.Image "${PATH}" Auto Leak
!endif
!macroend
!macro MUI_HEADERIMAGE_INITHELPER_LOADIMAGE UN RTL IMGRESID PATH
GetDlgItem $mui.Header.Image $HWNDPARENT ${IMGRESID} ; This variable is not used by every mode but we have to reference it to avoid a compiler warning.
!if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" == "NoStretchNoCropNoAlign"
SetBrandingImage /IMGID=${IMGRESID} "${PATH}"
!else if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" == "NoStretchNoCrop"
!insertmacro MUI_HEADERIMAGE_INITHELPER_LOADIMAGEWITHMACRO \
MUI_LOADANDXALIGNIMAGE
!else if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" == "AspectFitHeight"
!insertmacro MUI_HEADERIMAGE_INITHELPER_LOADIMAGEWITHMACRO \
MUI_LOADANDASPECTSTRETCHIMAGETOCONTROLHEIGHT
!else
!if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" != "FitControl"
!warning 'MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH set to unknown value, defaulting to FitControl'
!endif
SetBrandingImage /IMGID=${IMGRESID} /RESIZETOFIT "${PATH}"
!endif
!macroend
>>>>>>You can detele all ${PATH}
🙂
;--------------------------------
;Initialization of GUI
!macro MUI_HEADERIMAGE_INITHELPER_LOADIMAGEWITHMACRO MACRO
!ifdef MUI_HEADERIMAGE_RIGHT
!ifndef MUI_OPTIMIZE_ALWAYSLTR ; Undocumented
${if} $(^RTL) == 1
!insertmacro ${MACRO} $mui.Header.Image "${PATH}" Left Leak
${Else}
!insertmacro ${MACRO} $mui.Header.Image "${PATH}" Right Leak
${EndIf}
!else
!insertmacro ${MACRO} $mui.Header.Image "${PATH}" Right Leak
!endif
!else
!insertmacro ${MACRO} $mui.Header.Image "${PATH}" Auto Leak
!endif
!macroend
!macro MUI_HEADERIMAGE_INITHELPER_LOADIMAGE UN RTL IMGRESID PATH
GetDlgItem $mui.Header.Image $HWNDPARENT ${IMGRESID} ; This variable is not used by every mode but we have to reference it to avoid a compiler warning.
!if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" == "NoStretchNoCropNoAlign"
SetBrandingImage /IMGID=${IMGRESID} "${PATH}"
!else if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" == "NoStretchNoCrop"
!insertmacro MUI_HEADERIMAGE_INITHELPER_LOADIMAGEWITHMACRO \
MUI_LOADANDXALIGNIMAGE
!else if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" == "AspectFitHeight"
!insertmacro MUI_HEADERIMAGE_INITHELPER_LOADIMAGEWITHMACRO \
MUI_LOADANDASPECTSTRETCHIMAGETOCONTROLHEIGHT
!else
!if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" != "FitControl"
!warning 'MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH set to unknown value, defaulting to FitControl'
!endif
SetBrandingImage /IMGID=${IMGRESID} /RESIZETOFIT "${PATH}"
!endif
!macroend
>>>>>>You can detele all ${PATH}
🙂
As I understand this code should be placed in Interface.nsh. But what does it do? And how to use it?Originally Posted by meoit View PostIf you are using MUI2, open this file and edit: "\NSIS\Contrib\Modern UI 2\Interface.nsh" lines code follow:🙂
Edit it, do not paste into it.
AddBrandingImage top 0 0 Completely covers HEADERIMAGE_BITMAP place. Actually this looks like a miracle for me 🙂 If someone can explain how to use params of width and height there that would be perfect.
Thank you 😉Originally Posted by meoit View PostEdit it, do not paste into it.
Easier, replace file nsis.bmp at ""C:\Program Files\NSIS\Contrib\Graphics\Header\nsis.bmp" with your bmp file, dimension: 150x57 pixels. 🙂
I have 5 different custom pages, every one has it's own branding image. Replacing will not help 😉Originally Posted by meoit View PostEasier, replace file nsis.bmp at ""C:\Program Files\NSIS\Contrib\Graphics\Header\nsis.bmp" with your bmp file, dimension: 150x57 pixels. 🙂
Moreover now I can place there image with ANY width and ANY height 🙂
Unfortunately AddbrandingImage/SetbrandingImage doesn't work for Windows 8/10 ... Does anybody now why?
Answering myself. Everything works, it's me noobing. Images should be included to installer as far as they are set in their places at run-time.Originally Posted by oldfriend View PostUnfortunately AddbrandingImage/SetbrandingImage doesn't work for Windows 8/10 ... Does anybody now why?