Skip to content
⌘ NSIS Forum Archive

IO bitmap

11 posts

fishsauce#

IO bitmap

I'm using normal installoptions2, and for some reason my code keeps on crashing if I try to display the bitmap.

!include "XPUI.nsh"
Name "InstallOptions"
OutFile "InstallOptions.exe"
!define XPUI_ABORTWARNING
Page custom CustomPageA
!insertmacro XPUI_PAGE_INSTFILES
    
!insertmacro XPUI_LANGUAGE "English"
ReserveFile "welcome.ini"
ReserveFile "..\support\heading_welcome.bmp"
!insertmacro XPUI_RESERVEFILE_INSTALLOPTIONS
Section "Dummy Section" SecDummy
SectionEnd
Function .onInit
  !insertmacro XPUI_INSTALLOPTIONS_EXTRACT "welcome.ini"
  File "/oname=$PLUGINSDIR\image.bmp" "..\support\heading_welcome.bmp"
FunctionEnd
Function CustomPageA
  !insertmacro XPUI_HEADER_TEXT "" ""
  !insertmacro XPUI_INSTALLOPTIONS_WRITE "welcome.ini" "Field 1" "Text" "$PLUGINSDIR\image.bmp"
  !insertmacro XPUI_INSTALLOPTIONS_WRITE "welcome.ini" "Field 2" "Text" "asdf asdf"
  !insertmacro XPUI_INSTALLOPTIONS_DISPLAY "welcome.ini"
FunctionEnd 
Any ideas? Thanks!

And please ignore missing backslashes in the pathnames... for some reason they don't show up in the forum.
fishsauce#edited
Double posting because it won't let me edit my old message...

I'm starting to suspect the bmp file itself. It used to be 24-bit, but I changed it to a 256 color bmp and it still doesn't work. Is there some special format the file itself needs to be in?

For the record, the pathname is properly written into the INI file and the image also extracts correctly. Using other bmps doesn't work either... I even tried a bmp that was being used by XPUI itself.

Thanks.
fishsauce#
NSI:

!include "XPUI.nsh"

Name "InstallOptions"
OutFile "InstallOptions.exe"
!define XPUI_ABORTWARNING

Page custom CustomPageA
!insertmacro XPUI_PAGE_INSTFILES

!insertmacro XPUI_LANGUAGE "English"

ReserveFile "welcome.ini"
ReserveFile "heading_welcome.bmp"
!insertmacro XPUI_RESERVEFILE_INSTALLOPTIONS

Section "Dummy Section" SecDummy
SectionEnd

Function .onInit
InitPluginsDir
FunctionEnd

Function CustomPageA
!insertmacro XPUI_INSTALLOPTIONS_EXTRACT "welcome.ini"
File "/oname=$PLUGINSDIR\image.bmp" "heading_welcome.bmp"
!insertmacro XPUI_HEADER_TEXT "" ""
!insertmacro XPUI_INSTALLOPTIONS_WRITE "welcome.ini" "Field 1" "Text" "$PLUGINSDIR\image.bmp"
!insertmacro XPUI_INSTALLOPTIONS_DISPLAY "welcome.ini"
FunctionEnd


INI:

[Settings]
NumFields=1

[Field 1]
Type=Bitmap
Left=0
Right=140
Top=0
Bottom=300
Flags=TRANSPARENT
fishsauce#
Oh, there we go... it works now! *kicks himself for not trying out something so simple first*

It's cut off on the left but I'm pretty sure I can fix that with a bit of tweaking the left/right arguments in the INI.

Thanks!