• Advertisement
Sign in to follow this  

Embedding an icon into a MSVC2005 express .exe

This topic is 4157 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

Hello, Is it possible to embed an .ico into the executable generated by MSVC 2005 express? How do I go about it? I have the icon, added to the project. What next? Thanks for your help Simon

Share this post


Link to post
Share on other sites
Advertisement
Hey Simon,

Because there is no resource editor available with free 2005 Express edition you'll have to write the .rc file by hand. Or use a separate program to generate it (I used Visual C++ 6.0). I have embedded icons in my .exe files successfully, here are some relevant code snippets:

In the .rc file
Quote:

//Resource File
#include "Resource.h"

IDI_ICON1 ICON DISCARDABLE "IconName.ico"


And then when you initialize your window class you'll want to set the following members...this is how I do it, it works fine for me...

Quote:

m_wndclass.hIcon = LoadIcon(m_hInstance, MAKEINTRESOURCE("IDI_ICON1"));
m_wndclass.hIconSm = LoadIcon(m_hInstance, MAKEINTRESOURCE("IDI_ICON1"));


I hope that could be of some help to you.

- Dan

Share this post


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

  • Advertisement