winresource icon indicating copy to clipboard operation
winresource copied to clipboard

set_icon uses a wrong icon ID

Open Korne127 opened this issue 9 months ago • 0 comments

In #12, the default icon id has been changed from 1 to 32512. I've written longer about my findings and experiments with icon IDs in this pull request, but summarized: Visual Studio uses 32512 as the icon id if you only include one application icon. That's the main reason this change has been made. Microsoft documentation states that 32512 is used as "default application icon" but I think this documentation has been misinterpret and that you should use that number in case your application wants to load the general Windows default icon and not your own custom application icon.

Additionally, I found an old Microsoft documentation from 1995 which states that some versions of Windows choose the order in which but the newer version uses the "icon with the numerically lowest identifier" (if they're not named) and "the alphabetically first named group icons" (if one exists). This documentation has originally been used by winres as the reason to use 1 as the identifier for set_icon.

As this documentation was very old, I tested it myself and compiled two versions with Icons with both ID 1 and 32512. One version had the icon 1 in front of the icon 32512, one had the icon 32512 in front of the icon 1. But both had the icon with the id 1 as the application icon: image

This means that the change to 32512 isn't correct as it could break (change their application icon) projects with other icons with a lower ids. @zedseven Can you maybe create a test project in Visual Studio with several icons and look at how they're named? Then we could change the behaviour of winresource to match that. Perhaps Visual Studio uses 32512 only for projects with a single icon for some (outdated) convention reasons as it doesn't matter if only one icon is included, but also uses a numerical order if you include several icons.

Korne127 avatar May 09 '24 18:05 Korne127