Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Code for changing an EXE's icon?

187 views
Skip to first unread message

theodo...@gmail.com

unread,
Jun 19, 2013, 5:14:28 AM6/19/13
to
Anybody have any code (that works under win7) for modifying
a specified EXE's icon?

Or is there a way to specify an icon during compile time using
compiler directives?

Maarten Wiltink

unread,
Jun 19, 2013, 5:31:47 AM6/19/13
to
<theodo...@gmail.com> wrote in message
news:ac0af0e0-cd70-4b14...@googlegroups.com...
> Anybody have any code (that works under win7) for modifying
> a specified EXE's icon?

This can be done, but...


> Or is there a way to specify an icon during compile time using
> compiler directives?

This is by far the easier option. You can set the icon in the
project options, or if you're really bent on doing it through
compiler directives, include a resource file that has the icon
in it using $R. You may have to remove Delphi's own icon from
then standard resource file using a resource editor, and take
care that it doesn't get reinstated.

Personally, I'd set the icon in the project options.

Groetjes,
Maarten Wiltink


theodo...@gmail.com

unread,
Jun 19, 2013, 6:23:23 AM6/19/13
to
On Wednesday, 19 June 2013 10:31:47 UTC+1, Maarten Wiltink wrote:
> <theodo...@gmail.com> wrote in message
>
> news:ac0af0e0-cd70-4b14...@googlegroups.com...
>
> > Anybody have any code (that works under win7) for modifying
>
> > a specified EXE's icon?
>
>
>
> This can be done, but...

I found some code from here, but it doesn't appear to work on Windows 7 (claims to have change icon but doesn't appear too)

http://tinyurl.com/32ln66m

>
>
>
>
>
> > Or is there a way to specify an icon during compile time using
>
> > compiler directives?
>
>
>
> This is by far the easier option. You can set the icon in the
>
> project options, or if you're really bent on doing it through
>
> compiler directives, include a resource file that has the icon
>
> in it using $R. You may have to remove Delphi's own icon from
>
> then standard resource file using a resource editor, and take
>
> care that it doesn't get reinstated.
>
>
>
> Personally, I'd set the icon in the project options.

That might my best option. I have one project that changes depending on
compiler directives (full & trial versions) and I want different icons for them
but do not want to have to keep remembering to change the project's icon each
time.

Jamie

unread,
Jun 19, 2013, 5:24:36 PM6/19/13
to
You can change the icon to what ever you wish at start up..

Just have the icons stored in the resource file and you create a TIcon
object, load it from resource and then Application.Icon := myIconObject;

You do this in the main source file before the main form runs.

It's been a while but I am sure that is how it's done.


Jamie

0 new messages