Jump to content
  • Advertisement
Sign in to follow this  
KanonBaum

Adding icon to my exe in Visual Studio 2008

This topic is 2604 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need help adding an icon to my exe built by Visual Studio 2008 C++. I've looked online, and everyone suggests going to the "Application Window/Tab" under properties, but I've looked and it's not there.
Does it change anything that I've using Advanced View and not Basic (as it started out with?)

Much thanks.

Share this post


Link to post
Share on other sites
Advertisement
@yewbie: I think you got him wrong, he wants to have an icon for his exe file and not his window.

@topic: If you want to handle icons efficiently you need to use the Ultimate edition of Visual studio. Or, at least not the express version. Ultimate has a great resource manager where you just load a bitmap, save an icon and set that icon.

There are other ways but they are not always working at all..

Share this post


Link to post
Share on other sites
ResEdit is a great tool, but it is quite simple to set your exe's icon without a resource editor. Express version of VS doesn't include the resource editor.

Create a header file in your project called resource.h or something and add something like this:

#define MAIN_ICON 1001

Right-click on your project's Resources folder and do add new, then add a file with the same name as your exe (by convention) but with a .rc extension.

If you try to open this, by default the environment tries to use the resource editor, then tells you it isn't included. Right click it and do "Open with..." then select the source editor.

Assuming your .ico file is in the same directory as your source code, add this line to the .rc file:

#include "resource.h"

MAIN_ICON ICON my_icon.ico

If you compile and build the application, the exe's icon will be set to this icon. By default, Windows uses the first icon included in an exe as its icon to display in file browsers etc.

You can also load this icon to appear in the title bar using the relevant field of the WNDCLASSEX structure, as mentioned above, but this is unrelated to setting the application icon for Windows.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!