ICONINFOEXA structure (winuser.h)

Contains information about an icon or a cursor. Extends ICONINFO. Used by GetIconInfoEx.

Syntax

typedef struct _ICONINFOEXA {
  DWORD   cbSize;
  BOOL    fIcon;
  DWORD   xHotspot;
  DWORD   yHotspot;
  HBITMAP hbmMask;
  HBITMAP hbmColor;
  WORD    wResID;
  CHAR    szModName[MAX_PATH];
  CHAR    szResName[MAX_PATH];
} ICONINFOEXA, *PICONINFOEXA;

Members

cbSize

Type: DWORD

The size, in bytes, of this structure.

fIcon

Type: BOOL

Specifies whether this structure defines an icon or a cursor. A value of TRUE specifies an icon; FALSE specifies a cursor.

xHotspot

Type: DWORD

The x-coordinate of a cursor's hot spot. If this structure defines an icon, the hot spot is always in the center of the icon, and this member is ignored.

yHotspot

Type: DWORD

The y-coordinate of the cursor's hot spot. If this structure defines an icon, the hot spot is always in the center of the icon, and this member is ignored.

hbmMask

Type: HBITMAP

A handle to the icon monochrome mask bitmap.

hbmColor

Type: HBITMAP

A handle to the icon color bitmap.

wResID

Type: WORD

Resource identifier of the resource in szModName module. If the icon or cursor was loaded by name, then wResID is zero and szResName contains the resource name.

You can use MAKEINTRESOURCE(wResID) macro to convert resource identifier to a resource name type compatible with the resource-management functions.

szModName[MAX_PATH]

Type: TCHAR[MAX_PATH]

Name of the module from which an icon or a cursor was loaded.

You can use GetModuleHandle function to convert it to the module handle compatible with the resource-management functions.

szResName[MAX_PATH]

Type: TCHAR[MAX_PATH]

Resource name of the resource in szModName module.

Remarks

For monochrome icons, the hbmMask is twice the height of the icon (with the AND mask on top and the XOR mask on the bottom), and hbmColor is NULL. Also, in this case the height should be an even multiple of two.

For color icons, the hbmMask and hbmColor bitmaps are the same size, each of which is the size of the icon.

You can use a GetObject function to get contents of hbmMask and hbmColor in the BITMAP structure. The bitmap bits can be obtained with call to GetDIBits on the bitmaps in this structure.

ICONINFOEX is an extended version of ICONINFO structure with additional szModName/szResName/wResID members that can be used to query an icon or cursor resource bits. These bits are typically loaded by calls to the FindResource, LoadResource, LockResource and LookupIconIdFromDirectoryEx functions.

Note

The winuser.h header defines ICONINFOEX 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

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Header winuser.h (include Windows.h)

See also

Conceptual

CreateIconIndirect

GetIconInfo

Icons

Bitmaps

GetObject

BITMAP

GetDIBits

Reference