Skip to content

Improve the quality and accuracy of icon's fileextension attribute resolution (Icon::ResolveFileExtensionIcon()) #167

@end2endzone

Description

@end2endzone

Is your feature request related to a problem? Please describe.
On a Win10 system, the file extension "html" resolves the icon to C:\Program Files\Internet Explorer\iexplore.exe, -17. For my system, this is highly inaccurate since I do have Google Chrome installed as the default browser.

Describe the solution you'd like
The default icon should resolve to C:\Program Files\Google\Chrome\Application\chrome.exe, 0. Another way of putting it, would be to get the same icon as you do with File Explorer when you create a blank file with file extension. You want to get the same icon as the file.

Describe alternatives you've considered

  • We should leave the actual implementation available as a legacy feature.
  • Implementing a new resolution algorithm based on ExtractAssociatedIconExW with the following code as example :
  HINSTANCE hInstance = GetModuleHandle(NULL);
  char buffer[MAX_PATH];
  sprintf(buffer, "E:\\Temp\\tmp.html");
  WORD index = 0;
  WORD id = 0;
  HICON hIcon = ExtractAssociatedIconExA(hInstance, buffer, &index, &id);
  if ( hIcon == NULL )
  {
    DWORD dwLastError = GetLastError();
    printf("dwLastError = 0x%x", dwLastError);
  }
  if ( hIcon != NULL )
    DestroyIcon(hIcon);

Note that file E:\Temp\tmp.html must exists on system for the resolution to be successful.

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions