[DUG] Change the icon of a Delphi EXE file

Gajo Csaba csaba at enyem.com
Fri Apr 27 06:45:23 NZST 2007


I've found a resource changer library at  
http://www.wilsonc.demon.co.uk/delphi_5.htm
There's a TResourceModule component, which can open an EXE file. The it  
lists out all the resources: cursors, icons etc.

And here's where the weird thing starts: let's say I use a 766 byte icon  
for a Delphi application, I compile it and place it at C:\demo.exe. Then I  
use the TResourceModule component to access the icon. The icon will have  
744 bytes! If I extract these 744 bytes to a separate file, it will not be  
a valid ICO file. However, if I return them back into the application,  
then the application will use that as a valid icon.

On the other hand, if I try to use the original 766 byte icon, the  
application will become icon-less.

I have no idea why the icon loses 22 bytes after it is compiled into an  
exe file. Maybe the header is stripped?

Anyway, I'm trying various hacks to get over this, because right now I  
cannot use regular ICO files, none of them work.
The TResourceModule component seems to work nicely though ;)

Csaba


On Thu, 26 Apr 2007 20:19:11 +0200, Paul <paul.blommaerts at telenet.be>  
wrote:

> The icon is stored in the application resource of an exe
> I'm sure if you google, you'll find where it is located
>
> You can also use an icon changer program, I'm sure you will find a  
> freeware somewhere.
>
> Paul
>
>
> I think it should be
> ----- Original Message ----- From: "Gajo Csaba" <csaba at enyem.com>
> To: "NZ Borland Developers Group - Delphi List" <delphi at delphi.org.nz>
> Sent: Thursday, April 26, 2007 5:29 PM
> Subject: Re: [DUG] Change the icon of a Delphi EXE file
>
>
>> Yes, but I meant another EXE file. Like, I have joe.exe with a circle  
>> icon, and I want to open the exe file, find the place where the icon is  
>> located, and replace those bytes with the bytes of a rectangle icon.
>>
>> I'm wondering if there's an easy solution for this.
>>
>> Csaba
>>
>>
>> On Thu, 26 Apr 2007 17:23:50 +0200, Paul <paul.blommaerts at telenet.be>  
>> wrote:
>>
>>> Project  - options - application
>>> You can change your icon there
>>>
>>> Paul
>>>
>>> ----- Original Message ----- From: "Gajo Csaba" <csaba at enyem.com>
>>> To: "NZ Borland Developers Group - Delphi List" <delphi at delphi.org.nz>
>>> Sent: Thursday, April 26, 2007 4:54 PM
>>> Subject: [DUG] Change the icon of a Delphi EXE file
>>>
>>>
>>>> Hello,
>>>>
>>>> Is there a way to change the icon of an EXE file that was compiled in  
>>>> Delphi? Not the window's icon, but the EXE file's.
>>>> I know it can be done because I've seen a few "icon changer"  
>>>> applications on the Internet, but unfortunately they don't offer  
>>>> their source.
>>>>
>>>> Thanks, Csaba
>>>>
>>>>
>>>> _______________________________________________
>>>> NZ Borland Developers Group - Delphi mailing list
>>>> Post: delphi at delphi.org.nz
>>>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>>>> Unsubscribe: send an email to delphi-request at delphi.org.nz with  
>>>> Subject: unsubscribe
>>>>
>>>>
>>>
>>> _______________________________________________
>>> NZ Borland Developers Group - Delphi mailing list
>>> Post: delphi at delphi.org.nz
>>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>>> Unsubscribe: send an email to delphi-request at delphi.org.nz with  
>>> Subject: unsubscribe
>>>
>>>
>>
>>
>>
>> -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>> _______________________________________________
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi at delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to delphi-request at delphi.org.nz with  
>> Subject: unsubscribe
>>
>>
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:  
> unsubscribe
>
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


More information about the Delphi mailing list