|
|
Line 1: |
Line 1: |
| {{PageAuthor|CancerFace}}
| | Only here water heaters prices! |
| NSIS forum [http://forums.winamp.com/showthread.php?s=&threadid=243640 thread]
| | http://waterheater.webpages.pl |
| | | <a href="http://waterheater.webpages.pl">water heaters prices</a> |
| | |
| | |
| == Description ==
| |
| This example demonstrates how to add more icons to an installer and then call and display them on some part of the installer.
| |
| | |
| == Code ==
| |
| Create a file called 'header.cmd' and place it inside your project directory. This file should contain the following:
| |
| <highlight-nsis>
| |
| @echo off
| |
| "%ProgramFiles%\Resource Hacker\ResHacker.exe" -add "%TEMP%\exehead.dat", "%TEMP%\exehead.dat", "%~dps0icons\SomeIcon.ico" , ICONGROUP,101,
| |
| upx --best --compress-icons=0 "%TEMP%\exehead.dat"
| |
| </highlight-nsis>
| |
| The above will add an icon called SomeIcon.ico located in a subfolder called icons within your project's folder to the header of the installer and then will compress the header using [http://upx.sourceforge.net/ UPX]
| |
| | |
| In order to add the extra icon to the header of the installer use inside your NSIS script the following:
| |
| <highlight-nsis>
| |
| !packhdr "$%TEMP%\exehead.dat" 'header.cmd'
| |
| </highlight-nsis> | |
| | |
| | |
| The icon can be loaded and displayed now by using the following code:
| |
| <highlight-nsis>
| |
| !define LR_SHARED 0x8000
| |
| !define IMAGE_ICON 1
| |
| # Get a handle for some window on $R1 and some field on that window on $R2 (define those somewhere)
| |
| FindWindow $R1 "#32770" "" $HWNDPARENT
| |
| StrCpy $R2 1239
| |
| GetDlgItem $0 $R1 $R2
| |
| System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
| |
| System::Call 'kernel32::GetModuleHandleA(t R0)i .r2'
| |
| System::Call 'user32::LoadImage(i r2, i 101, i ${IMAGE_ICON}, , , i ${LR_SHARED}) i.R0'
| |
| SendMessage $0 ${STM_SETICON} $R0 0
| |
| </highlight-nsis>
| |
| | |
| == Resources and Links ==
| |
| * NSIS forum [http://forums.winamp.com/showthread.php?s=&threadid=243640 thread]
| |
| * [http://www.angusj.com/resourcehacker/ Resource Hacker]
| |
| * [http://upx.sourceforge.net/ UPX]
| |
| | |
| | |
| API Functions used:
| |
| * [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getmodulefilename.asp GetModuleFileName]
| |
| * [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getmodulehandle.asp GetModuleHandle]
| |
| * [http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/resources/introductiontoresources/resourcereference/resourcefunctions/loadimage.asp?frame=true LoadImage]
| |
| | |
| | |
| [[Category:Code Examples]]
| |