Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify an application icon for C++ Visual Studio 2019?

I've seen this documentation for C#/Visual Basic application icons, but there is nothing I can find for how to do this with the C++ version.

This StackOverflow question is for Visual Studio 2008, not 2019. This one is also obsolete, as it works for Visual Studio 2017 but not Visual Studio 2019.

like image 617
Sciborg Avatar asked Jun 28 '20 00:06

Sciborg


1 Answers

After some fiddling I figured it out. This answer for VS2017 was basically correct, but it didn't fully explain what you have to do to get it to work and the documentation it links to was vague enough to confuse me, so I'll post this answer as the VS2019 version with full and complete easy-to-follow instructions.

  1. Navigate to your Solution Explorer tab.

  2. Find the Resource Files folder in your project, probably near your Header Files and Source Files folders.

  3. Right-click on the Resource Files folder and select "Add > Resource."

  4. In the "Add Resource" window that pops up, select Icon and select Import.

  5. Import either a bitmap file or your custom .ico file.

  6. Now a Resource File (.rc) is created which contains your application Icon, in the form of an Icon node. Click on that .rc file to open the Resource View tab.

  7. You'll see that there's a folder called Icon. It should contain your new icon.

If it contains a default Icon file, probably named IDI_ICON1, you'll have to edit that node to make it the icon you want to use. I don't know why it does that.

like image 141
Sciborg Avatar answered Oct 10 '22 01:10

Sciborg