Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application Image 1

Status
Not open for further replies.

rogerte

Programmer
Nov 9, 2001
164
GB
We have a Delphi (4) app that is used in slightly different formats by 4 different customers.

We use conditional defines to determine the versions.

At present the default icon (the one that appears in Explorer) is the default Delphi Icon, and we use the condition defines to change the icon at run time. Now the customers are asking that "their" icon displays in Explorer.
I cannot work out how to do this at compile time, other than manually changing the icon in the properties box.

Is it possible, and if so how?

Thanks
 
Hi :)

How about trying something like

Application.Icon.LoadFromFile('c:\TestIcon.ico');

 
Thanks for the reply, but this only changes the icon at run-time - ie the icon that appears on the task bar.

I need to change the icon that shows when the app is not active, eg in Explorer, or on the desktop.

I know it must be done at compile time, but it looks like the only way to do it is by changing the icon for each build in the project properties at compile time.

Roger
 
There are free tools available for changing the icon, right after the compile, or just before the generation of the Install set, I just haven't looked around, as I don't need it. Have a look at there should be something around.

HTH
TonHu
 
There is one more way. You can find where the icon image lies (inside exe), determine it's size and then patch the file. I know it's not the best way but it gonna work.
 
Thanks, but I reckon it's probably easier to change the icon using the project/properties.

Just pity there isn't a way to set it using a conditional define.

Roger
 
hi
Why not create a shortcut and change it's icon.

Couldn't you do the following (in file explorer):

- stick the .exe in a sub directory, Right click and copy it.
- in the parent of the sub directory, Paste it's shortcut
- Then, right click on the shortcut and select Properties
- Click on the 'Change Icon' button. You can then 'steal' their icon from another app, or just select an icon file.
- Then, just copy and paste the shortcut on the desktop. The new icon will appear in file explorer aswell as the desktop (for the shortcut).

lou
 
In your .dpr file:

Code:
{$Define VERSION1}
{.Define VERSION2}
{.Define VERSION3}

{$Ifdef VERSION1}
{$R App1.RES}
{$Else}
{$Ifdef VERSION2}
{$R App2.RES}
{$Else}
{$R App.RES}
{$Endif}
{$Endif}

The App1.res & App2.res etc. files can be copied from App.res after changing the icon to the requested picture, and after that set it back to the default icon. By setting or using the right $Define line, you get the correct icon in your exe. If using some generic $include file, better put or get the Define from there.

HTH
TonHu
 
rogerte,

Have we answered your question enough? Please report back.

Thnx
TonHu
 
Thanks everyone

Sorry I havn't answered before, but have been away for a few days with no PC and therefore no I'Net connection.

TonHu's reply has worked a treat.

Once again - Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top