Skip to content
⌘ NSIS Forum Archive

Heacer Image not displayed, Startmenu entires not removed

7 posts

Guest#

Heacer Image not displayed, Startmenu entires not removed

I have the following script. The problem is the header image is not displayed and the startmenu entries are not removed after unistallation.

; BT4Dsign Demo installer
;
; This script is based on example2.nsi

;--------------------------------
;Include Modern UI

!include "MUI.nsh"

; The name of the installer
Name "BT4Dsign Demo"

; The file to write
OutFile "InstallBT4DsignDemo.exe"

; The default installation directory
InstallDir $PROGRAMFILES\BT4Dsign_Demo

; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\BT4DsignDemo" "Install_Dir"

;--------------------------------
!define MUI_ICON "BTIcon.ico"
!define MUI_UNICON "BTIcon.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "Image_Installer.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "Image_Installer.bmp"
!define MUI_ABORTWARNING

!insertmacro MUI_PAGE_LICENSE "DemoLicense.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES


; The stuff to install
Section "BT4Dsign Demo" demo

SectionIn RO

; Set output path to the installation directory.
SetOutPath $INSTDIR

; Put file there
File /r "bin"
File /r "lib"
File /r "jre"
File /r "profiledb"
File "BTIcon.ico"
File "Image_Installer.bmp"

; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\BT4DsignDemo "Install_Dir" "$INSTDIR"

; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BT4DsignDemo" "DisplayName" "BT4Dsign Demo"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BT4DsignDemo" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BT4DsignDemo" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BT4DsignDemo" "NoRepair" 1
WriteUninstaller "uninstall.exe"

WriteRegStr HKCR ".btp" "" "BT.Project"
WriteRegStr HKCR "BT.Project" "" "BT Project File"
WriteRegStr HKCR "BT.Project\DefaultIcon" "" "$INSTDIR\BTIcon.ico"
ReadRegStr $R0 HKCR "BT.Project\shell\open\command" ""
WriteRegStr HKCR "BT.Project\shell" "" "open"
WriteRegStr HKCR "BT.Project\shell\open\command" "" '$INSTDIR\jre\bin\javaw.exe -jar "$INSTDIR\bin\BT4Dsign.jar" -f "%1"'

;System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'


SectionEnd

; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts" shortcuts
SetOutPath $INSTDIR\bin
CreateDirectory "$SMPROGRAMS\BT4Dsign\Demo"
CreateShortCut "$SMPROGRAMS\BT4Dsign\Demo\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\BT4Dsign\Demo\BT4Dsign.lnk" "$INSTDIR\bin\BT4Dsign.exe" "" "$INSTDIR\bin\BT4Dsign.exe" 0
CreateShortCut "$SMPROGRAMS\BT4Dsign\Demo\BT4Dsign_de.lnk" "$INSTDIR\bin\BT4Dsign_de.exe" "" "$INSTDIR\bin\BT4Dsign_de.exe" 0
CreateShortCut "$SMPROGRAMS\BT4Dsign\Demo\BT4Dsign_en.lnk" "$INSTDIR\bin\BT4Dsign_en.exe" "" "$INSTDIR\bin\BT4Dsign_en.exe" 0

SectionEnd
;--------------------------------
;Descriptions

;Language strings
LangString DESC_Demo ${LANG_ENGLISH} "Installes the BT4Dsign demo."
LangString DESC_shortcuts ${LANG_ENGLISH} "Installes shortcuts for BT4Dsign demo."

;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Demo} $(DESC_Demo)
!insertmacro MUI_DESCRIPTION_TEXT ${shortcuts} $(DESC_shortcuts)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------

; Uninstaller

Section "Uninstall"


; Remove directories used
Delete "$SMPROGRAMS\BT4Dsign\Demo\BT4Dsign.ink"
Delete "$SMPROGRAMS\BT4Dsign\Demo\Uninstall.ink"
RMDir /r "$SMPROGRAMS\BT4Design"
RMDir /r "$INSTDIR"

; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BT4DsignDemo"
DeleteRegKey HKLM SOFTWARE\BT4DsignDemo

DeleteRegKey HKCR ".btp"
DeleteRegKey HKCR "BT.Project"


SectionEnd
Takhir#
Delete "$SMPROGRAMS\BT4Dsign\Demo\BT4Dsign.lnk"
Delete "$SMPROGRAMS\BT4Dsign\Demo\Uninstall.lnk"
and may be full path
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-colorful.ico"
Takhir#
Works in my test with bmp in the current (nsi) and Header folders (full path), original NSIS MUI header size image (150x57) and with another size, 8 and 24 bits/color.. So find the difference - start with existing NSIS headers and replace one with you Image_Installer.bmp content.
BTW you can skip last 2 File command if these files not required for your application - compiller includes image resources to uninstaller without this.