Reputation: 735
I currently use SHGetStockIconInfo to get default Windows dialog icons like Warning, Error, Help or Info. Unfortunately, it only supports 16px (small) and 32px (large) icons even on high-dpi screens. On a screen with 200% scaling, I would need these icons with 64px.
I found alternative API methods to get system icons, but none of them seem to support high-dpi, i.e. larger sizes.
What is the correct way to get large Windows dialog icons?
Upvotes: 1
Views: 255
Reputation: 735
@RbMm provided the perfect suggestion as a comment. To close this question, I'm adding it here as an answer.
LoadIconWithScaleDown does the job perfectly. It loads the icon in the specified standard size without any scaling (or scales a non-standard size down from a larger available size). It can be used to load system images just as well:
If hinst is NULL, pszName specifies either the name of a standalone icon (.ico) file or the identifier of a predefined icon to load. The following identifiers are recognized. To pass these constants to the LoadIconWithScaleDown function, use the MAKEINTRESOURCE macro. For example, to load the IDI_ERROR icon, pass MAKEINTRESOURCE(IDI_ERROR) as the pszName parameter and NULL as the hinst parameter.
Upvotes: 0