Archive: how to display a bmp in IO custom page


how to display a bmp in IO custom page
either a single bmp control or mixed either other controls. I am pretty sure i am not doing it correctly. just not the header or side. what i want is a full page image.


you might wanna try HM NIS, to easily edit your IO page


i did use it to create the ini file.
the problem i am having is showing the bmp on the resulting custom page.


Maybe some code will help.


page shows but bmp does not
---- IO ini file -----------
; Ini file generated by the HM NIS Edit IO designer.
[Settings]
NumFields=1
Rect=1044

[Field 1]
Type=Bitmap
state=stacon30thnew.bmp
Left=1
Right=331
Top=1
Bottom=193
Flags=RESIZETOFIT
------------------------

---- NSI file ---------
; Script generated by the HM NIS Edit Script Wizard.

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "My application"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "My company, Inc."
!define PRODUCT_WEB_SITE "http://www.mycompany.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\AppMainExe.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

; MUI 1.67 compatible ------
!include "MUI.nsh"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"

page custom customBMPpage

; Welcome page
!insertmacro MUI_PAGE_WELCOME

; Instfiles page
!insertmacro MUI_PAGE_INSTFILES

; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\AppMainExe.exe"
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "$PROGRAMFILES\My application"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show

Section "MainSection" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
; File "c:\path\to\file\AppMainExe.exe"
CreateDirectory "$SMPROGRAMS\My application"
CreateShortCut "$SMPROGRAMS\My application\My application.lnk" "$INSTDIR\AppMainExe.exe"
CreateShortCut "$DESKTOP\My application.lnk" "$INSTDIR\AppMainExe.exe"
; File "c:\path\to\file\Example.file"
SectionEnd

Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\My application\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\My application\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\AppMainExe.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\AppMainExe.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd

Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR\customBMP.ini "..\customBMP.ini"
File /oname=$PLUGINSDIR\stacon30thnew.bmp "..\Competitor spec program\stacon30thnew.bmp"
FunctionEnd

Function customBMPpage
Push $R0
Push $R1
Push $R2

InstallOptions::Dialog /NOUNLOAD $PLUGINSDIR\customBMP.ini

Pop $R0 ;<- This part is where "cancel" is returned
;when the user click "Cancel".

StrCmp $R0 "cancel" 0 EndCancel ;<- Checking the value
InstallOptions::Dialog "" ;<- Unloading and deleting plugin
EndCancel:


Pop $R0
FunctionEnd

Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd

Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd

Section Uninstall
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\Example.file"
Delete "$INSTDIR\AppMainExe.exe"

Delete "$SMPROGRAMS\My application\Uninstall.lnk"
Delete "$SMPROGRAMS\My application\Website.lnk"
Delete "$DESKTOP\My application.lnk"
Delete "$SMPROGRAMS\My application\My application.lnk"

RMDir "$SMPROGRAMS\My application"
RMDir "$INSTDIR"

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd


This should work. I have the path to the bitmap in the:

Text=.....

and it works great. so try this:


[Settings]
NumFields=1
Rect=1044

[Field 1]
Type=Bitmap
Text=stacon30thnew.bmp
Left=1
Right=331
Top=1
Bottom=193
Flags=RESIZETOFIT


the BMP : stacon30thnew.bmp must be in the same folder as the ini file

ok that did it. why does the ini and pic have to be in the same directory initially?????
i moved the picture to the same folder i had the ini in and poof it works.
whats confusing is that it extracts them to the same temp folder when it runs.

ps thanks for them help. being confused and freustrated at the same time is REALLY bad.


Hello,

I would make a classic installer with a top image on each
window. Can I use this script also? Or does it works only for modern-ui?

First I would make it with "AddBrandingImage" but I don't know how I integrate the bitmap. And it seems that nobody
know it too.

rien


oktested install on clean pc and guess what. no bmp in page. after some checking the bmp is extracted to the temp folder with the other files ( InstallOptions.dll, etc) it doesent show. this is really agravationg. I thinks its working buts its not really on a clean test pc.


You must write the path of the bmp to the ini file on runtime.