CreateIconFromResourceEx function
Creates an icon or cursor from resource bits describing the icon.
Syntax
HICON WINAPI CreateIconFromResourceEx( _In_ PBYTE pbIconBits, _In_ DWORD cbIconBits, _In_ BOOL fIcon, _In_ DWORD dwVersion, _In_ int cxDesired, _In_ int cyDesired, _In_ UINT uFlags );
Parameters
- pbIconBits [in]
-
Type: PBYTE
The icon or cursor resource bits. These bits are typically loaded by calls to the LookupIconIdFromDirectoryEx and LoadResource functions.
- cbIconBits [in]
-
Type: DWORD
The size, in bytes, of the set of bits pointed to by the pbIconBits parameter.
- fIcon [in]
-
Type: BOOL
Indicates 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 [in]
-
Type: DWORD
The version number of the icon or cursor format for the resource bits pointed to by the pbIconBits parameter. The value must be greater than or equal to 0x00020000 and less than or equal to 0x00030000. This parameter is generally set to 0x00030000.
- cxDesired [in]
-
Type: int
The desired width, in pixels, of the icon or cursor. If this parameter is zero, the function uses the SM_CXICON or SM_CXCURSOR system metric value to set the width.
- cyDesired [in]
-
Type: int
The desired height, in pixels, of the icon or cursor. If this parameter is zero, the function uses the SM_CYICON or SM_CYCURSOR system metric value to set the height.
- uFlags [in]
-
Type: UINT
A combination of the following values.
Return value
Type: HICON
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.
Remarks
The CreateIconFromResource, CreateIconFromResourceEx, CreateIconIndirect, GetIconInfo, and LookupIconIdFromDirectoryEx functions allow shell applications and icon browsers to examine and use resources throughout the system.
You should call DestroyIcon for icons created with CreateIconFromResourceEx.
Examples
For an example, see Sharing Icon Resources.
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- Reference
- CreateIconFromResource
- CreateIconIndirect
- DestroyIcon
- GetIconInfo
- LoadResource
- LookupIconIdFromDirectoryEx
- Conceptual
- Icons
- Other Resources
- BITMAPINFOHEADER