LoadIconA function (winuser.h)
Loads the specified icon resource from the executable (.exe) file associated with an application instance.
Syntax
HICON LoadIconA(
[in, optional] HINSTANCE hInstance,
[in] LPCSTR lpIconName
);
Parameters
[in, optional] hInstance
Type: HINSTANCE
A handle to an instance of the module whose executable file contains the icon to be loaded. This parameter must be NULL when a standard icon is being loaded.
[in] lpIconName
Type: LPCTSTR
The name of the icon resource to be loaded. Alternatively, this parameter can contain the resource identifier in the low-order word and zero in the high-order word. Use the MAKEINTRESOURCE macro to create this value.
To use one of the predefined icons, set the hInstance parameter to NULL and the lpIconName parameter to one of the following values.
Return value
Type: HICON
If the function succeeds, the return value is a handle to the newly loaded icon.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Remarks
LoadIcon loads the icon resource only if it has not been loaded; otherwise, it retrieves a handle to the existing resource. The function searches the icon resource for the icon most appropriate for the current display. The icon resource can be a color or monochrome bitmap.
LoadIcon can only load an icon whose size conforms to the SM_CXICON and SM_CYICON system metric values. Use the LoadImage function to load icons of other sizes.
Note
The winuser.h header defines LoadIcon as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | winuser.h (include Windows.h) |
Library | User32.lib |
DLL | User32.dll |
API set | ext-ms-win-ntuser-gui-l1-1-0 (introduced in Windows 8) |
See also
Conceptual
Reference