"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > 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?

Posted on 2025-03-23
Browse:311

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
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3