Archive: what is wrong ?


what is wrong ?
hi

please help me -

what is wrong , why i can't display image ?

!include "MUI.nsh"
;!include "LogicLib.nsh"


Name "Modern UI Test"
OutFile "HeaderBitmap.exe"
InstallDir "$PROGRAMFILES\Modern UI Test"
InstallDirRegKey HKCU "Software\Modern UI Test" ""

;--------------------------------
;Interface Configuration
Var HWND
ReserveFile `.\skin0.bmp`
!define STM_SETIMAGE 0x0172
!define STM_GETIMAGE 0x0173
!define IMAGE_BITMAP 0
!define IMAGE_ICON 1
!define IMAGE_CURSOR 2
!define LR_CREATEDIBSECTION 0x2000
!define LR_LOADFROMFILE 0x0010
!define CB_GETCURSEL 0x0147


!define MUI_HEADERIMAGE_BITMAP header.bmp
!define MUI_HEADERIMAGE_RIGHT
!define MUI_HEADERIMAGE
!define MUI_ABORTWARNING

;--------------------------------
;Pages

Page custom SetCustom

!define MUI_PAGE_HEADER_TEXT "Licencja"
!define MUI_PAGE_HEADER_SUBTEXT "Licencja"
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Contrib\Modern UI\License.txt"

!define MUI_PAGE_HEADER_TEXT "Komponenty"
!define MUI_PAGE_HEADER_SUBTEXT "Komponenty"
!insertmacro MUI_PAGE_COMPONENTS



!macro LoadImage ReslutVar HWND IMG_NAME IMG_TYPE
File skin0.bmp
Push `${IMG_NAME}`
Push ${HWND}
Exch $0
Exch
Exch $1
Push $2
System::Call 'user32::LoadImage(i, t, i, i, i, i) i \
(0, "$1", ${IMG_TYPE}, 0, 0, ${LR_CREATEDIBSECTION}|${LR_LOADFROMFILE}) .r2'
SendMessage $0 ${STM_SETIMAGE} ${IMG_TYPE} $2 ;HANDLE
Push $2
Exch
Pop $2
Exch
Pop $1
Exch
Pop $0
Pop ${ReslutVar} ;HANDLE
!macroend

!macro DeleteObject HWND
System::Call 'Gdi32::DeleteObject(i) i (${HWND})'
!macroend


Function SetCustom
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "banner.ini"
Pop $HWND
GetDlgItem $1 $HWND 1201
!insertmacro LoadImage $0 $1 "$PLUGINSDIR\skin0.bmp" ${IMAGE_BITMAP}
!insertmacro MUI_HEADER_TEXT "A" "A"
; !insertmacro DeleteObject $0

!insertmacro MUI_INSTALLOPTIONS_DISPLAY "banner.ini"
FunctionEnd

; !insertmacro MUI_PAGE_DIRECTORY
; !insertmacro MUI_PAGE_INSTFILES

;!insertmacro MUI_UNPAGE_CONFIRM
;!insertmacro MUI_UNPAGE_INSTFILES

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "Polish"

;--------------------------------
;Installer Sections

Section "Dummy Section" SecDummy

SetOutPath "$INSTDIR"

;ADD YOUR OWN FILES HERE...

;Store installation folder
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR

;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"

SectionEnd

;--------------------------------
;Descriptions

;Language strings
LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."

;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

;--------------------------------
;Uninstaller Section

Section "Uninstall"

;ADD YOUR OWN FILES HERE...

Delete "$INSTDIR\Uninstall.exe"

RMDir "$INSTDIR"

DeleteRegKey /ifempty HKCU "Software\Modern UI Test"

SectionEnd


You don't need to use LoadImage to display an image on an InstallOptions page. All you need to do is to extract the image and write its location to the Text value of the bitmap field in the INI. Something like:

!insertmacro MUI_INSTALLOPTIONS_EXTRACT "banner.ini"
File /oname=$PLUGINSDIR\image.bmp blah.bmp
!insertmacro MUI_INSTALLOPTIONS_WRITE "banner.ini" "Field 2" "Text" "$PLUGINSDIR\image.bmp"
!insertmacro MUI_INSTALLOPTIOS_DISPLAY "banner.ini"

very thanks

evrything is ok , but i dont understand this :
File /oname=$PLUGINSDIR\image.bmp blah.bmp

blah.bmp - its mein bitmap files
image.bmp - what is it?


thanks a lot


The "image.bmp" is the name of the file when it is extracted in the plugin directory.

You can use it without the "image.bmp" like this:

setoutpath "$pluginsdir"
file "blah.bmp"
!insertmacro MUI_INSTALLOPTIONS_WRITE "banner.ini" "Field 2" "Text" "$PLUGINSDIR\blah.bmp"
!insertmacro MUI_INSTALLOPTIOS_DISPLAY "banner.ini"