Archive: Can't get AddBrandingImage/SetBrandingImage to work


Can't get AddBrandingImage/SetBrandingImage to work
Hello,

I'm trying to insert a branding image at the top of the installer without success. I used AddBrandingImage to reserve space for the image and this part works.

But in my main installing section I'm using SetBrandingImage title.bmp but the bitmap isn't being displayed although it resides in the same directory where the installer is located in.

Another question, isn't it possible to link the bitmap to the installer instead of the need to ship it?

EDIT: Why do I have to set the branding image in a section? Isn't it possible to set the branding image for the whole installer?

Thanks in advance,

Nils


If you are using the MUI (Modern User Interface) you just need to add these 3 lines below your "!include "MUI.nsh"" line:


!include "MUI.nsh"
!define MUI_WELCOMEFINISHPAGE_BITMAP "LeftPanel.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "Header.bmp"


Hope this helps.
Jnuw

I didn't use the MUI but tried it with the same result. Space is reserved for the image, but it isn't being displayed.

Any other tips?


How about show us your code, what you have so we can see what's wrong


No problem, here it is:


; Installation Script (C) 2006 by MyCompanyName Software GmbH

!include "versioncheck.nsi"
!include "Sections.nsh"

; __________________________________________________________
;

!define NAME "MyProgramName"
!define EDITORNAME "MyProgramName - Karteneditor"
!define EXE "bin\S2C.exe"
!define EDITOREXE "bin\S2CEditor.exe"

!define SECTION_PROGRAMFILES "Programmdateien (benötigt)"
!define SECTIONGROUP_SHORTCUTS "Verknüpfungen"
!define SECTION_STARTMENU "Startmenü"
!define SECTION_DESKTOP "Desktop"

; __________________________________________________________
;

Name "${NAME}"
OutFile "..\Autorun\setup.exe"

Icon "fun_32x32.ico"
UninstallIcon "fun_32x32.ico"

InstallDir "$PROGRAMFILES\MyPublisherName\MyCompanyName\${NAME}"

LicenseData license.txt
LicenseForceSelection checkbox "Ich habe die Lizenzbestimmungen gelesen und stimme ihnen zu"

CompletedText "Installation abgeschlossen"
DetailsButtonText "Details anzeigen"
InstallButtonText "Installieren"

SpaceTexts "Benötigter Speicherplatz: " "Verfügbarer Speicherplatz: "

SubCaption 0 "Lizenzbestimmungen"
SubCaption 1 " "
SubCaption 2 "Installationsverzeichnis"
SubCaption 3 "Installiere Dateien"
SubCaption 4 "Abgeschlossen"

MiscButtonText "Zurück" "Weiter >" "Abbrechen" "Beenden"

UninstallButtonText "Deinstallieren"
UninstallCaption "${NAME} Deinstallation"
UninstallText "Die folgende Anwendung wird ${NAME} deinstallieren. Drücken sie Weiter um fortzufahren." "Verzeichnis:"

UninstallSubCaption 0 " "
UninstallSubCaption 1 " "
UninstallSubCaption 2 " "

DirText "Wählen sie das Verzeichnis aus, in welches ${NAME} installiert werden soll:" "Zielverzeichnis" "Durchsuchen..." "Verzeichnis wählen"
ComponentText "Die folgende Anwendung wird ${NAME} auf ihrem Computer installieren. Bitte wählen sie aus, welche Komponenten sie installieren möchten." " " "Wählen sie die zu installierenden Komponenten"

; THIS ONE DOESN'T WORK
AddBrandingImage top 124
BrandingText " "

; _______________________
;

AutoCloseWindow true
XPStyle on
ShowInstDetails show

; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "SOFTWARE\MyPublisherName\MyCompanyName\${NAME}" "Install_Dir"

; _______________________
; Program files
;

Section "${SECTION_PROGRAMFILES}"

; AND THIS ONE DOESN'T WORK EITHER
SetBrandingImage /RESIZETOFIT "title.bmp"

; Set output path to the installation directory.
; Put files there

SetOutPath $INSTDIR\bin
File "..\${EXE}"
File "..\${EDITOREXE}"
File "..\bin\*.dll"

SetOutPath $INSTDIR\data
;File /r "..\data\*.*"

SetOutPath $INSTDIR

; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\MyPublisherName\MyCompanyName\${NAME}" "Install_Dir" "$INSTDIR"

; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyPublisherName\MyCompanyName\${NAME}" "DisplayName" "${NAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyPublisherName\MyCompanyName\${NAME}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteUninstaller "uninstall.exe"
SectionEnd

; _______________________
; Shortcuts
;

Var DirectXVersion
Var Result

Section "DirectX 9.0c"
ReadRegStr $DirectXVersion HKLM "Software\Microsoft\DirectX" "Version"
!define Ver2 "4.09.00.0904"
${VersionCheck} "$DirectXVersion" "${Ver2}" $Result

IntCmp $Result 2 equal less more
less:
more:
;!insertmacro UnselectSection "DirectX 9.0c"
SectionIn RO
Goto done
equal:
ExecWait "DirectX/directx_9c_redist.exe"
done:
SectionEnd

; _______________________
; Shortcuts
;

SectionGroup "${SECTIONGROUP_SHORTCUTS}"
Section "${SECTION_STARTMENU}"
CreateDirectory "$SMPROGRAMS\MyPublisherName\MyCompanyName\${NAME}"
CreateShortCut "$SMPROGRAMS\MyPublisherName\MyCompanyName\${NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\MyPublisherName\MyCompanyName\${NAME}\${NAME}.lnk" "$INSTDIR\${EXE}" "" "$INSTDIR\${EXE}" 0
CreateShortCut "$SMPROGRAMS\MyPublisherName\MyCompanyName\${NAME}\${NAME}.lnk" "$INSTDIR\${EDITOREXE}" "" "$INSTDIR\${EDITOREXE}" 0
SectionEnd

Section "${SECTION_DESKTOP}"
CreateShortCut "$DESKTOP\${NAME}.lnk" "$INSTDIR\${EXE}" "" "$INSTDIR\${EXE}" 0
CreateShortCut "$DESKTOP\${NAME}.lnk" "$INSTDIR\${EDITOREXE}" "" "$INSTDIR\${EDITOREXE}" 0
SectionEnd
SectionGroupEnd

; _______________________
; Uninstall
;

Section "Uninstall"
; remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyPublisherName\MyCompanyName\${NAME}"
DeleteRegKey HKLM "SOFTWARE\MyPublisherName\MyCompanyName\${NAME}"

; remove shortcuts, if any.
Delete "$SMPROGRAMS\MyPublisherName\MyCompanyName\${NAME}\*.*"
RMDir "$SMPROGRAMS\MyPublisherName\MyCompanyName\${NAME}"
Delete "$DESKTOP\${NAME}.lnk"

; remove files
RMDir /r "$INSTDIR"
SectionEnd

; _______________________
; Callbacks
;

Function .onInstSuccess
; MessageBox MB_YESNO "Möchten sie ${NAME} nun starten?" IDNO NoStart
Exec "autorun.exe"
; NoStart:
FunctionEnd

Function .onUserAbort
Exec "autorun.exe"
FunctionEnd


The bitmap has a size of 342x124 pixels, 24bit.

Many thanks,

Nils

MUI_HEADERIMAGE_BITMAP would most likely require you to put your bitmap images in $PLUGINSDIR, not $EXEDIR.
If your bitmap resides in the same folder as your installer, you still need to tell the installer that it is there by using the $EXEDIR constant, e.g. SetBrandingImage `$EXEDIR\title.bmp`
or by setting the working folder to $EXEDIR with SetOutPath first. Without calling SetOutPath, the working directory is usually $DESKTOP (which is the highest level directory in the directory hierarchy).

-Stu