We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,344 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Change Win32 Icon

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

3
Contributors
3
Replies
16 Hours
Discussion Span
2 Years Ago
Last Updated
4
Views
Question
Answered
Alexkid
Light Poster
35 posts since Apr 2007
Reputation Points: 16
Solved Threads: 0
Skill Endorsements: 0

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

IDR_MAINFRAME ICON "res\\mfc_test.ico"

Cheers
Milton

Milton Neal
Junior Poster in Training
59 posts since Sep 2010
Reputation Points: 10
Solved Threads: 13
Skill Endorsements: 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.

dylank
Junior Poster in Training
66 posts since Oct 2009
Reputation Points: 10
Solved Threads: 3
Skill Endorsements: 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

Alexkid
Light Poster
35 posts since Apr 2007
Reputation Points: 16
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 2 Years Ago by dylank and Milton Neal

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0746 seconds using 2.72MB