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:
- Enable Resource View: Press Ctrl Shift E or navigate to View > Resource View.
- Add the icon resource: Right-click on the project name, select Add > Resource, choose Icon, and click Import.
- Filter for .ico files: When the file selection dialog appears, change the file filter to .ico since .ico files are not listed by default.
- Import the .ico file: Select the desired .ico file and click Open.
- 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
Copy after login
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!