Archive: MUI- Header Image


MUI- Header Image
I am unable to display my own header bitmap in MUI pls. have alook at the script below and point out my mistake.


;###################################################
;UI START
!include "MUI.nsh"

;###################################################
;GENRAL
Name "Graphics 2.0.84"
OutFile "C:\Documents and Settings\me\Desktop\Installer\Scripts\Setup_Graphicsv2.0.83.Exe"
;DEFAULT INSTALL DIR
InstallDir "$PROGRAMFILES\Graphics"
;GET INSTALL DIR FEOM REGISTRY
InstallDirRegKey HKCU "Software\Graphics" ""
SetDateSave on
SetDatablockOptimize on
CRCCheck on
!define MUI_HEADERBITMAP "C:\Documents and Settings\me\Desktop\Installer\Nsis\Contrib\Icons\Header.bmp"

;###################################################
;VARIABLES
Var MUI_TEMP
Var STARTMENU_FOLDER

;###################################################
;INTERFACE SETTINGS
!define MUI_ABORTWARNING
!define MUI_WELCOMEPAGE_TEXT "Quick Deployment Wizard will guide you through the installation of Graphics v 2.0.84.\r\n\r\n\r\n\n\n"
BRANDINGTEXT "Visit www.deepesh.info for Free Quick Deployment Wizard"

;###################################################
;PAGES
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "C:\Documents and Settings\me\Desktop\Installer\Nsis\Contrib\Icons\Licence.rtf"
!insertmacro MUI_PAGE_DIRECTORY
;START MENU FOLDER PAGE CONFIG
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Graphics"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!define MUI_SPECIALBITMAP ".\Contrib\Icons\Data.dat"
!define MUI_PROGRESSBAR

;###################################################
;LANGUAGES
;--------------- Remember the installer language -----------------------------------
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\strPname"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
;--------------- End of Remember the installer language Code -----------------------------------
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;------------- Reserve Files Extract Before Installation ---------

!insertmacro MUI_RESERVEFILE_LANGDLL

;-------------End of Reserve Files Extract Before Installation ---------


;###################################################
;SPLASH SCREEN SETTINGS
Function .onInit

!insertmacro MUI_LANGDLL_DISPLAY

SetOutPath $INSTDIR
FunctionEnd

;###################################################
;SPLASH SCREEN SETTINGS
;--------------------------------
;Installer Sections

Section "ToInstall"SecCopyUI
SetOutPath "$INSTDIR"
SetOutPath "$SYSDIR\"
File /a "C:\WINDOWS\system32\stdole2.tlb"
SetOutPath "$INSTDIR"
SetOutPath "$SYSDIR\"
File /a "C:\Documents and Settings\me\Desktop\Installer\SHELLLNK.TLB"
SetOutPath "$INSTDIR"
SetOutPath "$SYSDIR\"
File /a "C:\WINDOWS\system32\scrrun.dll"
SetOutPath "$INSTDIR"
SetOutPath "$SYSDIR\"
File /a "C:\WINDOWS\system32\TLBINF32.DLL"
SetOutPath "$INSTDIR"
SetOutPath "$SYSDIR\"
File /a "C:\WINDOWS\system32\Comdlg32.ocx"
SetOutPath "$INSTDIR"
SetOutPath "$SYSDIR\"
File /a "C:\WINDOWS\system32\Tabctl32.ocx"
SetOutPath "$INSTDIR"
SetOutPath "$SYSDIR\"
File /a "C:\WINDOWS\system32\Mscomctl.ocx"
SetOutPath "$INSTDIR"
SetOutPath "$SYSDIR\"
File /a "C:\Documents and Settings\me\Desktop\Installer\Gifxc.ocx"
SetOutPath "$INSTDIR"
SetOutPath "$SYSDIR\"
File /a "D:\Program Files\Graphics\explorer tree.ocx"
SetOutPath "$INSTDIR"

;Save Install Folder

WriteRegStr HKCU "Software\strPname" "" $INSTDIR
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Graphics" "DisplayName" "Graphics"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Graphics" "UninstallString" '"$INSTDIR\Uninstall.exe"'
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Gifxc.ocx.lnk" "$SYSDIR\Gifxc.ocx"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
CreateShortCut "$DESKTOP\.lnk" ""
RegDLL "$SYSDIR\explorer tree.ocx"
;Write Uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"

;-------------------- Write Log File ------------

StrCpy $0 $INSTDIR\Install.log
Push $0
Call DumpLog

;----------------- End of Write Log File -----------

SectionEnd
;--------------------------------

;------------------ Function to Dump Log File --------------
!define LVM_GETITEMCOUNT 0x1004
!define LVM_GETITEMTEXT 0x102D

Function DumpLog
Exch $5
Push $0
Push $1
Push $2
Push $3
Push $4
Push $6

FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1016
StrCmp $0 0 error
FileOpen $5 $5 "w"
StrCmp $5 0 error
SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
System::Alloc ${NSIS_MAX_STRLEN}
Pop $3
StrCpy $2 0
System::Call "*(i, i, i, i, i, i, i, i, i) i \
(0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
loop: StrCmp $2 $6 done
System::Call "User32::SendMessageA(i, i, i, i) i \
($0, ${LVM_GETITEMTEXT}, $2, r1)"
System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
FileWrite $5 "$4$\r$\n"
IntOp $2 $2 + 1
Goto loop
done:
FileClose $5
System::Free $1
System::Free $3
Goto exit
error:
MessageBox MB_OK error
exit:
Pop $6
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
Exch $5
FunctionEnd
;--------------- End of Function to Dump Log File -----------------
;--------------------------------

;Uninstaller Section
Section "Uninstall"
Delete "$SYSDIR\stdole2.tlb"
Delete "$SYSDIR\scrrun.dll"
Delete "$SYSDIR\TLBINF32.DLL"
Delete "$SYSDIR\Comdlg32.ocx"
Delete "$SYSDIR\Tabctl32.ocx"
Delete "$SYSDIR\Mscomctl.ocx"
Delete "$SYSDIR\Gifxc.ocx"
Delete $INSTDIR\Install.log
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
Delete "$DESKTOP\.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Gifxc.ocx.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
RMDir "$MUI_TEMP"
noshortcuts:
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\strPname"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Graphics"
IfFileExists "$INSTDIR" 0 NoErrorMsg
MessageBox MB_OK "Note: $INSTDIR could not be removed, because it is not Empty, Please Delete Manually." IDOK 0
NoErrorMsg:
SectionEnd
;--------------------------------
;Uninstaller Functions

Function un.onInit
;Get language from registry
ReadRegStr $LANGUAGE HKCU "Software\strPname" "Installer Language"
FunctionEnd
;-------------------------------------------------------------


Deepesh Agarwal,
http://www.freeware-alternative.uni.cc

Include

!define MUI_HEADERIMAGE
in your script.
And
!define MUI_HEADERIMAGE_BITMAP "C:\Documents and Settings\me\Desktop\Installer\Nsis\Contrib\Icons\Header.bmp"

instead
!define MUI_HEADERBITMAP "C:\Documents and Settings\me\Desktop\Installer\Nsis\Contrib\Icons\Header.bmp"
.

Thanks
Thank You Glory_men it worked.