1,105,295 Community Members

Change Win32 Icon

Member Avatar
Alexkid
Light Poster
35 posts since Apr 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Alex

Member Avatar
Milton Neal
Junior Poster in Training
61 posts since Sep 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 14 [?]
Skill Endorsements: 0 [?]
 
0
 

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

IDR_MAINFRAME ICON "res\\mfc_test.ico"

Cheers
Milton

Member Avatar
dylank
Junior Poster in Training
66 posts since Oct 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 3 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
Alexkid
Light Poster
35 posts since Apr 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

So...

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?

Cheers

Alex

Question Answered as of 3 Years Ago by dylank and Milton Neal
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: