Home Web Design Programming Fairlight CMI Soap Box Downloads Links Biography About... Site Map

The Holmes Page Getting the Right Icon

CA-Visual Objects CA-Clipper



BACK TO
CA-VISUAL
OBJECTS

CA-Visual Objects provides an easy way to set the icon for an application, but sometimes the wrong icon is displayed in Windows Explorer. What's going on?

The problem is that CA-VO displays the icons in order of creation, while Explorer displays them in alphabetical order.

Specifically, CA-VO sorts on the creation date of the icon resource. When you click on the Icon... button in the Application Options dialog, the IDE finds all the icon resources in the repository and displays them, like this:

 Highlight
Icons are arranged by resource creation date in CA-VO.
Icons displayed in CA-Visual Objects

In this test, I first created the yellow icon called BIcon with the text "#1 B icon", then the blue icon called AIcon with the text "#2 A icon".

Once the executable was built, I made a shortcut to it on the Windows Desktop and clicked on the Change Icon... button on the Shortcut tab of the Windows Properties dialog. This is what appeared:

 Highlight
Icons are arranged alphabetically by resource name in Explorer.
Icons displayed in Windows Explorer

You can see that the icons in the EXE are in a different order, in fact listed alphabetically by resource name. Although this can be corrected by selecting the desired icon for the shortcut (the LNK file), the program file itself (EXE) always shows the icon with the lowest alphabetical name, with no way to change it in Explorer.


The first icon resource in the program should be the default one -- the one that best represents your application -- because it will show up in Explorer.

 Solution
Copy and rename an existing icon resource.

The solution to this problem is to create a "dummy" resource for an icon in CA-VO and give it a name that is alphabetically lowest. Perhaps something like "0MainIcon".

My test application contained the following two resource entities after I created the icons with the Image Editor:

resource AIcon Icon C:\CAVO20\Resource\Aicon.ico
resource BIcon Icon C:\CAVO20\Resource\Bicon.ico

Since BIcon is the one that I want to represent the application, I copied and renamed it.

resource 0MainIcon Icon C:\CAVO20\Resource\Bicon.ico

Note that I didn't need to copy the class that was generated by the Image Editor, or the CA-VO Icon entity, just the resource. Most of your icons were probably created with the Image Editor, but all that is required by Windows is the resource definition.

This problem comes up in the first place because you naturally create the application icon first and then give it the same name as the application itself. As far as CA-VO is concerned, this is fine because the first icon that is created will appear first in the list, but the icon name may not be the first alphabetically. Now you know what to do about it!



Home Web Design Programming Fairlight CMI Soap Box Downloads Links Biography About... Site Map

Site Map Send comments about this site to Greg at gregh@ghservices.com
All pages copyright © 1996-1999 GH Services™   Created 1999/01/01   Last updated 1999/09/30
All trademarks contained herein are the property of their respective owners