Add extra icons to an installer: Difference between revisions
m (Reverted edits by 41.196.65.174 to last version by Kichik) |
|||
Line 5: | Line 5: | ||
== | comment5, <a href= "http://www.imechanica.org/user/11867" >Nice paris hilton sex tape</a><br>, 610, <a href= "http://www.imechanica.org/user/11870" >Very Short Skirts Here</a><br>, :-O, <a href= "http://www.imechanica.org/user/11869" >pamela anderson sex tape</a><br>, 6497, <a href= "http://www.imechanica.org/user/11866" >kim kardashian sex tape</a><br>, 484, <a href= "http://www.imechanica.org/user/11868" >ray j sex tape</a><br>, =-P, | ||
==Screenshot== | ==Screenshot== |
Revision as of 01:02, 7 March 2009
Author: CancerFace (talk, contrib) |
NSIS forum thread
comment5, <a href= "http://www.imechanica.org/user/11867" >Nice paris hilton sex tape</a>
, 610, <a href= "http://www.imechanica.org/user/11870" >Very Short Skirts Here</a>
, :-O, <a href= "http://www.imechanica.org/user/11869" >pamela anderson sex tape</a>
, 6497, <a href= "http://www.imechanica.org/user/11866" >kim kardashian sex tape</a>
, 484, <a href= "http://www.imechanica.org/user/11868" >ray j sex tape</a>
, =-P,
Screenshot
Code
Create a file called 'header.cmd' and place it inside your project directory. This file should contain the following:
@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"
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 UPX
In order to add the extra icon to the header of the installer use inside your NSIS script the following:
!packhdr "$%TEMP%\exehead.dat" 'header.cmd'
The icon can be loaded and displayed now by using the following code:
!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
Resources and Links
- NSIS forum thread
- Resource Hacker
- UPX
API Functions used: