The CreateIconFromResourceEx function creates an icon or cursor from resource bits describing the icon.
HICON CreateIconFromResourceEx(
PBYTE pbIconBits, // pointer to icon or cursor bits
DWORD cbIconBits, // number of bytes in bit buffer
BOOL fIcon, // icon or cursor flag
DWORD dwVersion, // format version
int cxDesired, // desired width of icon or cursor
int cyDesired, // desired height of icon or cursor
UINT uFlags // load resource flags
);
Format | dwVersion |
---|---|
Windows 2.x | 0x00020000 |
Windows 3.x | 0x00030000 |
All Win32-based applications use the Windows 3.x format for icons and cursors.
Value | Meaning |
---|---|
LR_DEFAULTCOLOR | Uses the default color format. |
LR_MONOCHROME | Creates a monochrome icon or cursor. |
If the function succeeds, the return value is a handle to the icon or cursor.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
The CreateIconFromResourceEx, CreateIconFromResource, CreateIconIndirect, GetIconInfo, and LookupIconIdFromDirectoryEx functions allow shell applications and icon browsers to examine and use resources from throughout the system.
Windows NT: Requires version 4.0 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in winuser.h.
Import Library: Use user32.lib.
Icons Overview, Icon Functions, BITMAPINFOHEADER, CreateIconFromResource, CreateIconIndirect, GetIconInfo, LoadResource, LookupIconIdFromDirectoryEx