Header Text / MUI2 / nsDialogs
Hi,
I just created my first installer using NSIS. I just can't set header text nor header image.
I tried:
!define MUI_PAGE_HEADER_TEXT "Title"
or
!insertmacro MUI_HEADER_TEXT "Title" "Subtitle"
but there's still an empty header bar.
What I'm doing wrong?
Var DotnetInstalled ; if OK no need to install
;/////////
; INCLUDES
;/////////
!include LogicLib.nsh ; Use more familiar flow control
!include "MUI2.nsh"
!include "x64.nsh" ; For using {RunningX64}
!include "DotNetVer.nsh" ; for ${HasDotNet4.0}
!include "nsDialogs.nsh" ; To create labels on a custom page
Name "MeetVideo DeskShare"
OutFile "MeetVideo DeskShare Setup.exe"
InstallDir "$PROGRAMFILES\MeetVideo DeskShare"
InstallDirRegKey HKLM "Software\MeetVideo_DeskShare" "Install_Dir"
RequestExecutionLevel admin
;--------------------------------
;Interface Configuration
!define MUI_PAGE_HEADER_TEXT "MeetVideo"
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_RUN "$INSTDIR\DeskShare.exe"
!define MUI_FINISHPAGE_RUN_TEXT "Start MeetVideo DeskShare"
;--------------------------------
; Pages
Page custom Welcome
Page custom CheckAndInstallDotNet "" ": .Net Framework"
page custom CheckAndInstallVcRedist "" ": VC++ Redistributable"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
; The stuff to install
Section "DeskShare (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
File /r "IncludeFiles\*.*"
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\MeetVideo_DeskShare "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DeskShare" "DisplayName" "MeetVideo DeskShare"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DeskShare" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DeskShare" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DeskShare" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\MeetVideo DeskShare"
CreateShortCut "$SMPROGRAMS\MeetVideo DeskShare\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\MeetVideo DeskShare\DeskShare.lnk" "$INSTDIR\DeskShare.exe" "" "$INSTDIR\DeskShare.exe" 0
SectionEnd
Section "Desktop Shortcut"
CreateShortCut "$DESKTOP\MeetVideo DeskShare\DeskShare.lnk" "$INSTDIR\DeskShare.exe" "" "$INSTDIR\DeskShare.exe" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DeskShare"
DeleteRegKey HKLM SOFTWARE\MeetVideo_DeskShare
; Remove files and uninstaller
Delete $INSTDIR\*.*
;Delete $INSTDIR\uninstall.exe
; Remove shortcuts, if any
Delete "$SMPROGRAMS\MeetVideo DeskShare\*.*"
; Remove directories used
RMDir "$SMPROGRAMS\MeetVideo DeskShare"
RMDir "$INSTDIR"
SectionEnd
Function Welcome
!insertmacro MUI_HEADER_TEXT "Title" "Subtitle"
nsDialogs::Create 1018 ;Create a Dialog Window
${NSD_CreateLabel} 0 0 100% 12u "MeetVideo DeskShare is an aplication for capturing and sharing desktop screen."
${NSD_CreateLabel} 0 24u 100% 12u "Following prerequisities will be installed if not present:"
${NSD_CreateLabel} 12u 36u 100% 12u ".NET Framework 4"
${NSD_CreateLabel} 12u 48u 100% 12u "VC++ Redistibutable"
${NSD_CreateLabel} 0 90% 100% 12u "(c) Copyright 2012, MONOGRAM Technologies. All rights reserved."
nsDialogs::Show
FunctionEnd
Function CheckAndInstallDotNet
nsDialogs::Create 1018 ;Create a Dialog Window
${NSD_CreateLabel} 0 0 100% 10% "Checking for .NET Framework 4.0 on your system ..."
;Check the DotNet Version
Call CheckDotNetFramework
; Install .net if not present
${If} $DotnetInstalled == ""
${NSD_CreateLabel} 0 40 100% 30u "Your System does not have .Net Framework 4.0 installed. \
Please click 'Next' to install the .Net Framework ..."
nsDialogs::Show ; show the dialog window
Call InstallDotNet
${Else}
${NSD_CreateLabel} 0 40 100% 30u "Your System has the required .Net Framework already installed. Please click Next \
to continue this installation."
nsDialogs::Show
${EndIf}
FunctionEnd
Function CheckDotNetFramework
${If} ${HasDotNet4.0}
Push "Microsoft .NET Framework 4.0 installed."
Pop $DotnetInstalled
${Else}
Push ""
Pop $DotnetInstalled
${EndIf}
FunctionEnd
Function InstallDotNet
SetOutPath '$TEMP'
SetOverwrite on
;file work UNDO to save time in debugging
File 'DeploymentResources\dotNetFx40_Client_x86_x64.exe'
ExecWait '"$TEMP\dotNetFx40_Client_x86_x64" /norestart'
Delete "$TEMP\dotNetFx40_Client_x86_x64.exe"
FunctionEnd
Function CheckAndInstallVcRedist
nsDialogs::Create 1018 ;Create a Dialog Window
${NSD_CreateLabel} 0 0 100% 30u "Checking for VC 2010 C++ Redistributable ..."
Call CheckVCRedist
StrCmp $R0 "-1" 0 +4
${NSD_CreateLabel} 0 40 100% 30u "Installing VC 2010 C++ Redistributable..."
Call InstallVcRedist
Goto +2
${NSD_CreateLabel} 0 40 100% 30u "VC 2010 C++ Redistributable already installed. \
Please click next to continue installation"
nsDialogs::Show ;show the dialog window
FunctionEnd
Function CheckVCRedist
; check for 2 possible keys in registry, if any one is good,
; the distributable has already been installed:
ReadRegDword $R0 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" "Installed"
${If} $R0 == 1
return
${Else}
ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" "Installed"
${If} $R0 == 1
return
${Else}
StrCpy $R0 "-1"
${EndIf}
${EndIf}
FunctionEnd
; install Visual Studio 2010 C++ redistributable
Function InstallVcRedist
SetOutPath '$TEMP'
SetOverwrite on
;file work
File 'DeploymentResources\vcredist_x86.exe'
ExecWait '"$TEMP\vcredist_x86.exe" /norestart'
Delete "$TEMP\vcredist_x86.exe"
FunctionEnd