Description

I had noticed a few questions in the forums that centered around the ability to display pictures while the installer was copying files. So I modified the ModernUI executable to add this function. The code used to actually display the images was created with a lot of help from ibartel and kichik. First copy the modern_instpic.exe file to the NSIS\Contrib\UIs folder. Then save the following script to nsis include folder. (Recommended Name: Image.nsh)

!ifndef LR_LOADFROMFILE
  !define LR_LOADFROMFILE     0x0010
!endif
 
!ifndef LR_CREATEDIBSECTION
  !define LR_CREATEDIBSECTION 0x2000
!endif
 
!ifndef STM_SETIMAGE
  !define STM_SETIMAGE        370
!endif
 
!ifndef IMAGE_BITMAP
  !define IMAGE_BITMAP        0
!endif
 
!ifndef sysLoadImage
  !define sysLoadImage        "user32::LoadImage(i, t, i, i, i, i) i"
!endif
 
!ifndef sysDeleteObject
  !define sysDeleteObject     "gdi32::DeleteObject(i) i"
!endif
 
!define MUI_UI "${NSISDIR}\Contrib\UIs\modern_instpic.exe"
ShowInstDetails nevershow
 
var ImageHandle
 
!macro DisplayImage IMG_NAME
  Push $0
  Push $1
  Push $6
  !define Index "Line${__LINE__}"
  GetTempFileName $1
  SetDetailsPrint textonly
  DetailPrint "Loading Image"
  StrCmp $6 '' "${Index}-First"
    StrCpy $6 $ImageHandle
    System::Call "${sysDeleteObject} (r6)"
    StrCpy $6 ''
 
"${Index}-First:"
  SetDetailsPrint none
  File /oname=$1 "${IMG_NAME}"
  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 2000
  System::Call '${sysLoadImage} (0, s, ${IMAGE_BITMAP}, 0, 0, ${LR_CREATEDIBSECTION}|${LR_LOADFROMFILE}) .r6' "$1"
  SendMessage $0 ${STM_SETIMAGE} ${IMAGE_BITMAP} $6
  StrCpy $ImageHandle $6
  Delete $1
  SetDetailsPrint textonly
 
  !undef Index
  Pop $6
  Pop $1
  Pop $0
!macroend

Usage Example

Now to use the modified version of the UI all you need to do is include the image.nsh file in your script and call the DisplayImage macro in your section(s).

!include "Image.nsh"
...
Section "Main"
  !insertmacro DisplayImage 'Image.bmp'
SectionEnd

And enjoy your newly modified installer capable of displaying images while installing files. Please note that you should not enable the details view of your installer as it WILL be displayed over the image.



Downloads

Downloads of ModernUI Install Pictures modification for NSIS
Release Date Changes Download Link & MD5Sum
13 February 2004 - v1.0 Removed dumpstate command used for debugging. Must of been asleep when posting the initial code.
Fixed problem with image getting erased when the window was redrawn.
Downloadcb151afc6af1a133­a51e1e385e4943c8

Support

If you are having problems with this plug-in or have any questions please contact me via the contact link above