Which windows API returns the taskbar icon size?

200 Views Asked by At

Windows 8 and above changed the (default-DPI) size of "big" taskbar icons (introduced in Windows 7) from 32×32 to 24×24. However, GetSystemMetrics(SM_CXICON) and GetSystemMetrics(SM_CXSMICON) still return 32 and 16 respectively.

Is there any Windows API that returns the actual size of (by default) 24?

2

There are 2 best solutions below

3
Nick On

I don't think there is such an API. You may use GetMonitorInfo(), and check the values of MONITORINFO.rcWork and MONITORINFO.rcMonitor (MONITORINFO)

4
Jeaninez - MSFT On

Refer to the Doc:Class Icons

To assign a large and small icon to a window class, specify the handles of the icons in the hIcon and hIconSm members of the WNDCLASSEX structure. The icon dimensions must conform to required dimensions for large and small class icons. For a large class icon, you can determine the required dimensions by specifying the SM_CXICON and SM_CYICON values in a call to the GetSystemMetrics function.

Call GetSystemMetrics with SM_CXICON to retrieve the size of the system large icon. As far as I'm concerned, you should try to set the hIcon member of WNDCLASSA.