How do I set the icon for my program in Visual C++ 2008 Express Edition?

4k views Asked by At

I want to set the embedded icon for my executable console program to a custom icon.

I know this is pretty much the same question as this one here, but I'm using Visual C++ 2008 Express Edition, and the Resources View is not available (and the Project-context-menu->Add->Resource... is grayed out), so I'm at loss here. Will I have to upgrade to a pro edition for such a basic task?

3

There are 3 answers

0
shf301 On BEST ANSWER

You can still add a resource in Express edition, but there is no resource editor GUI, you have to create the resource yourself using external tools.

The Win32 Platform SDK has a resource compiler (rc.exe) that will compile a resource script which is just a text file that you can write yourself. There are also free resource editors out there if you'd rather not create the file by hand.

The process is:

  1. Create the resource script
  2. Compile it using rc.exe to create a .rc file
  3. Add the .rc file to the Visual Studio C++ project
  4. Recompile
0
user956584 On
1. in notepad paste

AAA ICON myicon.ico


2. then save as resource.rc

3. add the resource.rc file to your project.

it works on visual studio, code::blocks and dev-c++

NOTE:
1. myicon.ico is the name of your icon.
2. myicon.ico should be in the same directory as resource.rc 
0
Miotsu On

Well, in your project's folder you should already have e compiled resource file called "app.rc" if you open it with a text editor you should find the lines:

// Icon placed first or with lowest ID value becomes application icon 1 ICON "app.ico"

just replace "app.ico" with your icon's filename and hey presto the magic's done.