So... how does one correctly grab the icon of a window given its HWND? Online sources say to use WM_GETICON or GCLP_HICON, but neither of those work for certain packaged apps, like calculator.
Kind of looks like I need to use IAppxManifestProperties to grab "Logo" from the appx
Conversation
Get the path of the executable and extract the icon from the resource section. Although obviously this might not match the Window…
1
2
Doesn't work for calculator on win11, you get a generic app icon, not the calculator icon.
1
Because CalculatorApp.exe is the process, and it has no icon... So I assume windows is grabbing the icon from the appxmanifest or something...
1
Yeah looks like it will require a bunch of annoying code with GetPackage and PackageFullNameFromId... any idea?
2
InternalGetWindowIcon doesn't return the icon for packaged processes - another issue is that function always returns a icon handle (even when the window doesn't have an icon - exceeding shared desktop heap limits and preventing applications from running)



