Aan
Aan

Reputation: 12910

How to change application icon in C++/CLI winform project?

How can I change the application (binary file) icon in Winform C++/CLI project? I am using MS VS 2010.

I tried to go to project properties and I found no Application tab: enter image description here

and here resources option:

enter image description here

Upvotes: 2

Views: 6710

Answers (2)

Ravi Kumar
Ravi Kumar

Reputation: 4528

In the Solution Explorer pane, right-click on your project name, then navigate to Add > Resource.

Add Resource Window

Here you can add icon and other meta data for your application.

Upvotes: 0

Joel Dean
Joel Dean

Reputation: 2454

You could try the method that was posted on this MSDN page. It got six up votes so it seemed like it worked.

Link: Changing .exe icons

The way Windows chooses the icon of the main executable file is that it looks for the first icon in the resource section of the executable, or something along these lines. First of all, you need to add a resource script, .rc file. This is done through Project->Add New Item or right click on solution explorer and go to Add->New Item. Chose Resource->Resrouce File(.rc) name it then add it.

Now you have the resource file then you add the icon to it. Go to resource view and right click on the name of your resource file. Right at the bottom you will find Add Resource, select that then a new window will pop up.

If you already have your icon saved seperatly then you should choose Import and then import the icon. Otherwise select Icon and then press New. The icon will be created and/or added to the resource script and you will find that when you build your project it will be the icon for the executable file.

If you want more than one icon in a project, make sure to add the one you want as the executable icon first, otherwise you will have to change the resource identifiers and put that icon as the lowest id.

Another approach you could take is to

  • Go to your Project Folder.
  • Overwrite the app.ico file that is located in that folder with a new icon of the same format.
  • Clean project.
  • Rebuild.

Upvotes: 5

Related Questions