Setting an icon for my .exe file in vc++

Started by
7 comments, last by MuruGuru 20 years, 11 months ago
Well, the title explains it all, how am i gonna do to do that?
Your memory is like cheese. It's full of holes, and most of it stinks
Advertisement
I suppose you are using VC IDE [Studio]. Goto your workspace and see if you have a folder called resource files. There double click on the RC file.
Then right click and select "Add resource"
Here you select from several resource types. [Choose icon].
Draw some icon image...... or if you have an image already... select import.

HTH,

Cheers!!!
V!
Cheers!!!V!
Well, i''ve done that but i want it to set as the main icon when i compile my program...
could anyone help me with that please?
Your memory is like cheese. It's full of holes, and most of it stinks
One crude [a.k.a hackish] way of doing this is to promote the "filename.ico" that you want to be set as the app''s icon to the IDI_ICON1 value in your RC file. [Open the .RC in a text editor].

If your .RC file looks like
IDI_ICON1 ICON "icon1.ico"
IDI_ICON2 ICON "icon2.ico"
IDI_ICON3 ICON "icon3.ico"
IDI_ICON4 ICON "icon4.ico"

and if "icon4.ico" is what you want to be set at your app icon, switch the order so that you get the following.
IDI_ICON1 ICON "icon4.ico"
IDI_ICON2 ICON "icon2.ico"
IDI_ICON3 ICON "icon3.ico"
IDI_ICON4 ICON "icon1.ico"

WARNING:
The only caveat is if you have too many icons that have been created already and are used for other purposes, you have to change their IDs appropriately.....



Cheers!!!
V!
Cheers!!!V!
MSDN search for WNDCLASS(EX) and LoadIcon()
Oooppsss!!!!
Agree with Kihaji....
I should have read your question a little more carefully. Sorry about that.

LoadIcon() should settle the case. If you are in a dialog based application you should have a way to do it in your OnInitDialog().
Set the m_hIcon to AfxGetApp()->LoadIcon(IDI_ICON_ID);

HTH,


Cheers!!!
V!
Cheers!!!V!
I think the first suggestion was better (order of the icons in the resource file)... Muru said the icon for the .exe file, not the window...
The icon Explorer uses for your exe is the first icon listed in the resource file.


Qui fut tout, et qui ne fut rien
Invader''s Realm
Now i tried some of theese things. I had to make some small changes, but the problem is solved. Thanks everybody
Your memory is like cheese. It's full of holes, and most of it stinks

This topic is closed to new replies.

Advertisement