Hi there,

Can anyone tell me how to change my win32 programs icon (top left). I'm running MSV C++ Express 2010, so i don't have MFC. Theres a few tutorials on how to do this but using resource files? Which apparently MSV doesn't support. I want to be able to use my own one, so not one in shell.dll (although that would be a start).

I think i have to:

Add the ico file to a resource file / header file
Import the resource file / header file in my program
Change wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION);

But a bit confused on how to actually code this, do I have to add the actual ico file in the resource folder or can I add the file location in the header / resource file, how do I create a header / resource file, etc?

Many Thanks


In your "progam_name.RC" file you will find the line:

IDR_MAINFRAME ICON "res\\mfc_test.ico"


You may need to open the RC file in something other than VC++2010, as the RC editor only edits the resources themselves. Open it in notepad or pnotepad.

Ok so I know what to change in the main program but the resources thing still puzzling.


Do I have to add the ico file to the resources folder, is that what res\\ does, looks in the resources folder? Or can I add its directory position i.e. C:/My Document etc.
How do I create an RC file, can I just rename a .h file to .rc and where does it go, in the resource folder presumeably?



Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.