Search code examples
visual-studioiconswxwidgets

Changing Application Icon in Visual Studio 2022


I have a Application project in VS 2022 and I added the appropriate .ico file to the icon resources, it is listed as IDI_ICON1. In all the research I have done, it indicates to open the Project Properties and then go to the Applications section and change the icon. I do not have an applications section.Properties Window There were other methods that indicated using the icon properties of the individual file, but that property doesn't exist? I am sure I am missing something simple.

I added the icon file to the resource file and tried to set the icon but cannot find how


Solution

  • For a Desktop Application, you could have just replaced the file small.ico with your new icon file, this file can be found in your projects folder, using this method there would be no other changes required.

    Alternatively if you've already added a new icon to the resource file and you want to change the icon that way, then search your code for LoadIcon

    You should see a line similar to:

    wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

    IDI_SMALL will be the default small icon ID, which points to small.ico, you can replace IDI_SMALL with your icon ID IDI_ICON1

    Presuming your icon is in the correct format then that is all that is required.

    This will change the small icon used in the applications title bar.