Archive: Set the bitmap in a custom page


Set the bitmap in a custom page
I tried serveral thing and I can't find anything in the Manual

Could somebody help have made a custom page with a bitmap in it, But how can I set for example this file to display the bitmap in my custom page "C:\arrow.bmp"

Thanks Again


Extract it to a temporary location ($PLUGINSDIR after using InitPluginsDir) and write the location to the InstallOptions INI file.


To add a bitmap to your custom page will be very simple if you follow the steps below:

1. You have to do as Joost writes, i.e. to unpack the bitmap to the pluginsdir

2. In the Pre function of your custom dialog write this code:

; Load the dialog
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\YourCustomDialog.ini"
Pop $R0

System::Call '${sysLoadImage} (0, \
"$PLUGINSDIR\yourbmp.bmp", \
${IMAGE_BITMAP}, \
0, \
0, \
${LR_CREATEDIBSECTION}|${LR_LOADFROMFILE}) .r6'



; Show your bmp in the "field" 1201
GetDlgItem $R3 $R0 1201 ;1200 + Field number - 1
SendMessage $R3 ${STM_SETIMAGE} ${IMAGE_BITMAP} $R6

; Show the dialog
InstallOptions::show

3. Now you'll be able to see your bmp in the custom page. Ofcourse that the field number might not be the same in your case. If you use HM NSIS Editor, you will ba able to choose the field number. Make sure you set the style "Bitmap" if you load a bitmap and "Icon" of you'll display an icon.

4. Other definitions that you might need:

!define sysLoadImage "user32::LoadImageA(i, t, i, i, i, i) i"

!ifndef IMAGE_BITMAP
!define IMAGE_BITMAP 0
!endif


!ifndef LR_LOADFROMFILE
!define LR_LOADFROMFILE 0x0010
!endif

!ifndef LR_CREATEDIBSECTION
!define LR_CREATEDIBSECTION 0x2000
!endif


Good luck
/Paul


There is no need to use Windows API. You only have to write the filename to the InstallOptions INI file.


I didn't knew that...
But now I know.
Anyway, I don't find it hard to use WinAPI either. If you use WinAPI you have other possibilities too, like stretching pictures.
/Paul


InstallOptions also has a RESIZETOFIT flag that allows you to stretch an image.


Using Win32 API in this case is not the best solution. It is not the simplest solutions either. I admit that. The best solutions is to use the built in stuff, ofcourse.


I got it thanks : heXor and Joost Verburg