LoadIconWithScaleDown function (commctrl.h)
Loads an icon. If the icon is not a standard size, this function scales down a larger image instead of scaling up a smaller image.
HRESULT LoadIconWithScaleDown( [in] HINSTANCE hinst, [in] PCWSTR pszName, [in] int cx, [in] int cy, [out] HICON *phico );
A handle to the module of either a DLL or executable (.exe) file that contains the icon to be loaded. For more information, see GetModuleHandle.
To load a predefined icon or a standalone icon file, set this parameter to NULL.
A pointer to a null-terminated, Unicode buffer that contains location information about the icon to load.
If hinst is non-NULL, pszName specifies the icon resource either by name or ordinal. This ordinal must be packaged by using the MAKEINTRESOURCE macro.
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.
The desired width, in pixels, of the icon.
The desired height, in pixels, of the icon.
When this function returns, contains a pointer to the handle of the loaded icon.
Returns S_OK if successful, or an error value otherwise, including the following:
||The contents of the buffer pointed to by pszName do not fit any of the expected interpretations.|
This function will first search the icon file for an icon having exactly the same size. If a match is not found, then unless both cx and cy match one of the standard icon sizes—16, 32, 48, or 256 pixels— the next largest icon is selected and then scaled down to the desired size. For example, if an icon with an x dimension of 40 pixels is requested by the callign application, the 48-pixel icon is used and scaled down to 40 pixels. In contrast, the LoadImage function selects the 32-pixel icon and scales it up to 40 pixels.
If the function is unable to locate a larger icon, it defaults to the standard behavior of finding the next smallest icon and scaling it up to the desired size.
|Minimum supported client||Windows Vista [desktop apps only]|
|Minimum supported server||Windows Server 2008 [desktop apps only]|