English 中文(简体)
How do I set the icon for my program in Visual C++ 2008 Express Edition?
原标题:

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?

最佳回答

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
问题回答

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.

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 




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签