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

Incorrect application Icon

0 views
Skip to first unread message

Andre Hoonhout

unread,
Nov 22, 2002, 10:07:12 AM11/22/02
to
I use Delphi 6.

Windows shows the wrong icon for my application in the Windows Explorer and
on Short Cuts. When I start the program it shows the correct icon in the
taskbar and at the left-top corner of my application window.

It always was ok, untill today. I have changed the icons, and delete the
.res files. Without succes.

I found article FAQ4438D on the borland site, but I do not understand this
what I have to do.

Please advice,

Andre


Andre Hoonhout

unread,
Nov 22, 2002, 10:41:22 AM11/22/02
to
Some extra info:
when I open the .RES file with Image Editor. It displays the correct icon,
which is named MAINICON. There are no other icons in this .res file.

Thanks
Andre

"Andre Hoonhout" <an...@cds-nl.com> wrote in message
news:3dde...@newsgroups.borland.com...

Michael Warner

unread,
Nov 22, 2002, 11:06:15 AM11/22/02
to
On Fri, 22 Nov 2002 16:07:12 +0100, "Andre Hoonhout" <an...@cds-nl.com> wrote:

>I use Delphi 6.
>
>Windows shows the wrong icon for my application in the Windows Explorer and
>on Short Cuts. When I start the program it shows the correct icon in the
>taskbar and at the left-top corner of my application window.

Windows' icon cache is probably messed up. I force a rebuild using TweakUI
when this happens (free from MS).

Jens Geyer

unread,
Nov 22, 2002, 12:50:48 PM11/22/02
to
When you are using Win9x or ME, there's a file named "ShellIconCache"
within you windows directory. You can delete this file (or rename it, if you
don't believe me). Then press F5 in the explorer window.

JensG


Andre Hoonhout

unread,
Nov 22, 2002, 1:48:30 PM11/22/02
to
Sorry, Michael,

It did not work. I downloaded the TweakUI and restarted my computer.
When I copy the .exe file another computer then I also shows the wrong icon.

Brdgs
Andre


"Michael Warner" <m...@ozemail.com.au> wrote in message
news:ldlstus54kmungcml...@4ax.com...

Andre Hoonhout

unread,
Nov 22, 2002, 1:49:50 PM11/22/02
to
Hi Jens,

I am using Windows XP.
I searched for the file anyway, but did not gfind it.

Brdgs
Andre


"Jens Geyer" <j...@vsx.net> wrote in message
news:3dde6bdb$1...@newsgroups.borland.com...

Marjan Venema

unread,
Nov 23, 2002, 5:15:18 AM11/23/02
to
> Windows shows the wrong icon for my application in the Windows Explorer and
> on Short Cuts. When I start the program it shows the correct icon in the
> taskbar and at the left-top corner of my application window.

I had this once. Tracked it down to a third-party component for which I did
not have the source. When I removed the component from my app, it was ok,
when I put it the component back in, the wrong behaviour reappeared. The
people supplying the component solved it, but didn't tell me how...

Not a solution, but maybe something for you to investigate.

Marjan
_________________________
Marjan Venema - BJM Software
info(AT)bjmsoftware(DOT)com
http://www.bjmsoftware.com

Guy Gervais

unread,
Nov 23, 2002, 10:41:20 AM11/23/02
to
On Sat, 23 Nov 2002 11:15:18 +0100, Marjan Venema
<in...@bjmsoftware.OhNoNotThis.com> wrote:

>> Windows shows the wrong icon for my application in the Windows Explorer and
>> on Short Cuts. When I start the program it shows the correct icon in the
>> taskbar and at the left-top corner of my application window.
>
>I had this once. Tracked it down to a third-party component for which I did
>not have the source. When I removed the component from my app, it was ok,
>when I put it the component back in, the wrong behaviour reappeared. The
>people supplying the component solved it, but didn't tell me how...

Do you have additional icons added to your .exe (in .res files)?
Delphi stores them by alphabetical order and includes the default icon
as MAINICON. If you've added icons with names coming before MAINICON,
they'll be the ones showing up in Explorer (which uses the first icon
by default).

I've solved that problem in one of my apps by prefixing all my icon
names (in the .rc file) with Z.


Alex Sporik

unread,
Nov 23, 2002, 1:00:15 PM11/23/02
to

"Andre Hoonhout" <an...@cds-nl.com> wrote in message
news:3dde7bfa$1...@newsgroups.borland.com...

> Sorry, Michael,
>
> It did not work. I downloaded the TweakUI and restarted my computer.
> When I copy the .exe file another computer then I also shows the wrong
icon.

Some ideas in addition to other replyes.

May be u have one icon for form and OTHER icon for application
(I mean in Project Options Wizard). Check it.
__________________________________________________

If application have 2 resource with same names only first is
allowed (means compiling order). Any other is include into exe
but not show as MAINICON.

Also better way to rebuild iconcashe is simply find and destroy. And then
restart computer

Alex

Marjan Venema

unread,
Nov 23, 2002, 7:09:33 PM11/23/02
to
> Do you have additional icons added to your .exe (in .res files)?
> Do you have additional icons added to your .exe (in .res files)?
> Delphi stores them by alphabetical order and includes the default icon
> as MAINICON. If you've added icons with names coming before MAINICON,
> they'll be the ones showing up in Explorer (which uses the first icon
> by default).
>
> I've solved that problem in one of my apps by prefixing all my icon
> names (in the .rc file) with Z.

I remember *I* didn't.
I remember the 3party people did have a MAINICON in their bpl file.
I questioned them as to whether this was the problem and they answered:

> The solution wasn't the removal of the MAINICON resource from the
> package res file though (we remove it just to be sure). It has to
> be some bug in Delphi in handling different version resource
> file. I won't bore you with details, but we think we fixed it.

I was using D5 at the time, all service packs installed that were available in
June 2000.

Andre Hoonhout

unread,
Nov 24, 2002, 7:36:27 AM11/24/02
to
Hi Guy,

I have only one icon in my project. I put it in their with Project Options.
I checked the .res file, and their is only one icon called MAINICON. So that
should be correct.
I used other .res files from other projects. I have created my own .res
file. But i never works.

Thanks
Andre

"Guy Gervais" <ggerv...@hotmail.com.no.spam> wrote in message
news:l68vtuc2q9urj2uhm...@4ax.com...

Jens Geyer

unread,
Nov 25, 2002, 4:50:50 AM11/25/02
to

> when I open the .RES file with Image Editor. It displays the correct icon,
> which is named MAINICON. There are no other icons in this .res file.

Are there other icons in your EXE? Windows uses the first icon from the exe,
IOW the name of the icon resource has effect on the icon which is used by
windows.

You can verify this using either a resource editor or opening the exe in the
Explorer's "Change icon" dialog box.

JensG


Jens Geyer

unread,
Nov 25, 2002, 4:53:08 AM11/25/02
to

> I have only one icon in my project. I put it in their with Project
Options.
> I checked the .res file, and their is only one icon called MAINICON. So
that
> should be correct.
> I used other .res files from other projects. I have created my own .res
> file. But i never works.
>

There my be more than one resource file included in your project, e.g. with
the {$R resfile.res}directive. Check the EXE file as I suggested in my other
posting.

JensG


Andre Hoonhout

unread,
Nov 25, 2002, 5:56:22 AM11/25/02
to
Hi Jens,
There is only one icon in the res file.
I have as directive {$R *.RES} and I have only one res file in the project
directory, which has the same name as the project file.

I have create a new project, and added all *.pas files to it and compiled
it, but then even there is a problem with the icon.

Although I work with Delphi 6, it shows the default icon of Delphi 2.

I think there is something wrong with my components or something, because my
other projects do not have this problem. The problem is only that is is a
large project with lots of .pas files, so it very hard to find out which
component is causing the problem.

Thanks
Andre

"Jens Geyer" <j...@vsx.net> wrote in message

news:3de1f054$1...@newsgroups.borland.com...

Jens Geyer

unread,
Nov 25, 2002, 7:31:47 AM11/25/02
to
> > Check the EXE file ...

> There is only one icon in the res file.

Sorry, but this answer does not satisfy my question.


JensG


Brian Slack

unread,
Nov 25, 2002, 12:46:15 PM11/25/02
to
I have come to this a bit late but it sounds like a problem I once had.

A Borland vlc file (I think it had an f in it) has an icon in it. I suggest
you remove units one by one until you find the bad one or curse me for
getting it wrong.

--

Brian Slack
http://www.depicus.com
"Wake On Lan" and "Remote Shutdown" Software

"Andre Hoonhout" <an...@cds-nl.com> wrote in message

news:3de2...@newsgroups.borland.com...

Guy Gervais

unread,
Nov 25, 2002, 2:45:54 PM11/25/02
to
On Mon, 25 Nov 2002 11:56:22 +0100, "Andre Hoonhout"
<an...@cds-nl.com> wrote:

>Hi Jens,
>There is only one icon in the res file.
>I have as directive {$R *.RES} and I have only one res file in the project
>directory, which has the same name as the project file.
>
>I have create a new project, and added all *.pas files to it and compiled
>it, but then even there is a problem with the icon.
>
>Although I work with Delphi 6, it shows the default icon of Delphi 2.
>
>I think there is something wrong with my components or something, because my
>other projects do not have this problem. The problem is only that is is a
>large project with lots of .pas files, so it very hard to find out which
>component is causing the problem.

Well here's a ugly hack for your problem. Add the icon you want to
your file using a .res file.

Create a xxx.rc file and put something like this in it:

AAAAA ICON C:\...path...\AppIcon.ico

Compile it with the BRC32 and then add it to your project using a {$R
xxx.res } directive.

That way, you'll have an icon resource named AAAAA that should be the
first one in your .exe.

Malcolm

unread,
Nov 26, 2002, 5:30:26 PM11/26/02
to
I used to have this problem - and after trying all the suggested
solutions without a reliable result (it would seem to work, then later
it would fail).

In all my projects I now simply put my icon in the .res file twice,
once as MAINICON and again with *any* other name. I have had no
problems since!

Just don't ask me to rationalise it - it works for me and I don't have
any more time to nail the cause.


Angus Johnson

unread,
Nov 26, 2002, 9:12:24 PM11/26/02
to
The rational is pretty simple:

All resources (including icons) once compiled into an exe are stored in
alphabetical order - with named resources before numbered resources. The
Windows OS will always use the first icongroup as the default. Hence if you
add an icon resource with a name alphabetically less than 'MAINICON' (eg
'ANICON'), 'MAINICON' will no longer appear as the default icon.

HTH ...

"Malcolm" <mal...@spam.will.bounce> wrote in message
news:3de3f609$1...@newsgroups.borland.com...

Malcolm

unread,
Nov 27, 2002, 5:54:04 AM11/27/02
to
I tried. I really did. Left the Delphi icon as MAINICON and put mine
as AAAA, worked for a bit ... then blooey, the delphi one takes over!

Judging from the number of times this issue gets raised and the
differing solutions offered, I just get a sneaking suspicion there is
something going on that has not been nailed down.

My solution works for me all the time (so far <g>). The others
didn't.
/shrug/


0 new messages