#WINDOWS 10 ICON RESIZE PROBLEM CODE#
So, the final code that works is to load a pointer to the LoadIconWithScaleDown function from Comctl32.dll (not shown) and use that if it was available, or fall back to the "regular/old" way: HICON hIcon = 0 For comparison:įINAL EDIT: As described below, the workaround for the issue is to scale the icons. While capturing images for demonstration purposes, I noticed the Volume Mixer icon itself looks poor.
#WINDOWS 10 ICON RESIZE PROBLEM WINDOWS#
if I have the size, provide it directly, otherwise provide the 256x256 one and Windows does scale it correctly.ĮDIT: Sadness ensues. In this case, however, I'm able to use GetDeviceCaps( hdc, LOGPIXELSX ) to determine what Windows wants. there's a slider there (requires log out/in for change).ĮDIT: I also want to point out that the Tray ICON suffers a similar scaling issue fate when in high-DPI modes (that is, when using Shell_NotifyIcon). This can be changed via right-click Desktop, Personalize, other: Display. But more and more I'm seeing computers default to 125%. Normally desktop scaling is 100% and I get the normal 96 result. Additionally I have tried including some 8-bit images but that doesn't seem to change things.ĮDIT: I'm using GetDeviceCaps( hdc, LOGPIXELSX ) (and Y) to determine the Desktop scaling. All of the sizes look great at the resolutions they are in the file (I was trying to put the ICO here or in imgur but apparently neither allow icons). The 256x256 one is PNG compressed, the others are raw. Has anyone found a solution that makes it so that BOTH icons look good?ĮDIT: In my icon file, I have the following resolutions: 256x256, 48x48, 32x32, 24x24, and 16x16, all 32-bit. If I exclude that, the Taskbar icon looks bad (terrible scaling) but the Volume Mixer at least is the right size: If I include that, the Taskbar icon looks great but the Volume Mixer isn't scaled and looks terrible.
The culprit is the "hi-res if available" part.
HICON hIcon = (HICON)::LoadImage( theApp.m_hInstance, MAKEINTRESOURCE( res_id ), IMAGE_ICON, 256, 256, LR_SHARED ) if we're Vista or more recent, use hi-def icons
Specifically, the following code is what I use to set the application's icon: // set icons the normal wayĬWnd.SetIcon( theApp.LoadIcon( res_id ), FALSE ) ĬWnd.SetIcon( theApp.LoadIcon( res_id ), TRUE ) nice! However, when you use a large-sized icon for your application (especially important in high-DPI when Windows scales your icons for the Taskbar, etc.), the icon in the Volume Mixer doesn't scale correctly. In the Windows Volume Mixer, when your application plays sounds, it adds your application's icon and a custom volume slider to adjust volume specific to that application.