Home >Backend Development >C++ >How do I Set the Executable Icon for a C Application in Visual Studio 2010?

How do I Set the Executable Icon for a C Application in Visual Studio 2010?

DDD
DDDOriginal
2024-10-31 15:50:02417browse

How do I Set the Executable Icon for a C   Application in Visual Studio 2010?

Setting Executable Icon in Visual Studio 2010

As highlighted in previous discussions, setting the icon for a C application in Visual Studio 2008 may not be as straightforward as you might think. Here's a detailed guide to help you navigate this process:

Prerequisites:

Ensure you have an .ico file. PNG images are not supported as executable icons.

Steps:

  1. Enable Resource View: Press Ctrl Shift E or navigate to View > Resource View.
  2. Add the icon resource: Right-click on the project name, select Add > Resource, choose Icon, and click Import.
  3. Filter for .ico files: When the file selection dialog appears, change the file filter to .ico since .ico files are not listed by default.
  4. Import the .ico file: Select the desired .ico file and click Open.
  5. Resource ID: By default, Visual Studio will automatically assign the icon with the lowest resource ID as the executable icon.

Gotchas to Watch Out For:

  • Conflicting Ids: If multiple .ico files are added to the project, ensure the preferred icon has the lowest resource ID (lowest number in resource.h).
  • Resource.h Modification: The resource ID can be edited manually in the resource.h file. For example, to set IDI_ICON2 as the executable icon:
//resource.h
#define IDI_ICON1                       106
#define IDI_ICON2                       103

The above is the detailed content of How do I Set the Executable Icon for a C Application in Visual Studio 2010?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn