HICON CreateIconFromResource(pbIconBits, cbIconBits, fIcon, dwVersion) | |||||
PBYTE pbIconBits; | /* address of icon or cursor bits | */ | |||
DWORD cbIconBits; | /* number of bytes in bit buffer | */ | |||
BOOL fIcon; | /* icon or cursor flag | */ | |||
DWORD dwVersion; | /* Windows format version | */ |
The CreateIconFromResource function creates an icon or cursor from resource bits describing the icon.
pbIconBits
Points to a buffer containing the icon or cursor resource bits.
cbIconBits
Specifies the size, in bytes, of the set of bits pointed to by the pbIconBits parameter.
fIcon
Specifies whether an icon or a cursor is to be created. If this parameter is TRUE, an icon is to be created. If it is FALSE, a cursor is to be created.
dwVersion
Specifies the version number of the icon or cursor format for the resource bits at pointed to by the pbIconBits parameter. This parameter can be one of the following values:
Format | dwVersion |
Windows 2.x | 0x00020000 |
Windows 3.x | 0x00030000 |
The return value is a handle to the icon or cursor if the function is successful. Otherwise, it is NULL. To obtain extended error information, use the GetLastError function.
All Win32 applications use the Windows 3.x format for icons and cursors.
An icon has a predefined hot spot, while a cursor has a hotspot at an arbitrary location.
The resource bits pointed to by pbIconBits are typically loaded by calls to LookupIconIdFromDirectory and LoadResource.
The LookupIconIdFromDirectory, CreateIconFromResource, GetIconInfo, CreateIconIndirect functions allow shell applications and icon browsers to look through resources efficiently, and to load, play, and store resource bits.
CreateIconIndirect, GetIconInfo, LookupIconIdFromDirectory