Sign in to follow this  
sipickles

Embedding an icon into a MSVC2005 express .exe

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this