Archive: How to include a picture in a custom page without a .ini file ??


How to include a picture in a custom page without a .ini file ??
Hello,

I found in those topics, lot of solutions to incude pictures in custom pages.

But they all use .ini files, and I haven't one. I only use .nsh files in which I write my different texts. Is it possible to recycle those lines and adapt them to a programm without .ini file ???



;Extract InstallOptions files
;$PLUGINSDIR will automatically be removed when the installer closes

InitPluginsDir
File /oname=$PLUGINSDIR\testimgs.ini "testimgs.ini"
File /oname=$PLUGINSDIR\image.bmp "${NSISDIR}\Contrib\Graphics\Checks\colorful.bmp"
File /oname=$PLUGINSDIR\image2.bmp "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp"
File /oname=$PLUGINSDIR\icon.ico "${NSISDIR}\Contrib\Graphics\Icons\pixel-install.ico"

;Write image paths to the INI file

WriteINIStr $PLUGINSDIR\testimgs.ini "Field 2" "Text" $PLUGINSDIR\image.bmp
WriteINIStr $PLUGINSDIR\testimgs.ini "Field 3" "Text" $PLUGINSDIR\image2.bmp
WriteINIStr $PLUGINSDIR\testimgs.ini "Field 4" "Text" $PLUGINSDIR\image.bmp
WriteINIStr $PLUGINSDIR\testimgs.ini "Field 5" "Text" $PLUGINSDIR\image2.bmp
WriteINIStr $PLUGINSDIR\testimgs.ini "Field 6" "Text" $PLUGINSDIR\icon.ico
;No Text for Field 7 so it'll show the installer's icon


This is the part "Write" who is the problem for me !

Thanks to your help !


I found the answer :

To everyone who could try to do the same, find the answer :


!include nsDialogs.nsh

Name nsDialogs
OutFile nsDialogs.exe

XPStyle on

Page custom nsDialogsImage
Page instfiles

Var Dialog
Var Image
Var ImageHandle

Function .onInit

InitPluginsDir
File /oname=$PLUGINSDIR\image.bmp "${NSISDIR}\Contrib\Graphics\Header\nsis-r.bmp"

FunctionEnd

Function nsDialogsImage

nsDialogs::Create 1018
Pop $Dialog

${If} $Dialog == error
Abort
${EndIf}

${NSD_CreateBitmap} 0 0 100% 100% ""
Pop $Image
${NSD_SetImage} $Image $PLUGINSDIR\image.bmp $ImageHandle

nsDialogs::Show

${NSD_FreeImage} $ImageHandle

FunctionEnd

Section
SectionEnd