GetIconInfo function (winuser.h)

Retrieves information about the specified icon or cursor.

Syntax

BOOL GetIconInfo(
  [in]  HICON     hIcon,
  [out] PICONINFO piconinfo
);

Parameters

[in] hIcon

Type: HICON

A handle to the icon or cursor.

To retrieve information about a standard icon or cursor, specify the identifier beginning with the IDI_ prefix or the identifier beginning with the IDC_ prefix in this parameter.

[out] piconinfo

Type: PICONINFO

A pointer to an ICONINFO structure. The function fills in the structure's members.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero and the function fills in the members of the specified ICONINFO structure.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

GetIconInfo creates bitmaps for the hbmMask and hbmColor or members of ICONINFO. The calling application must manage these bitmaps and delete them with DeleteObject call when they are no longer necessary.

DPI Virtualization

This API does not participate in DPI virtualization. The output returned is not affected by the DPI of the calling thread.

Requirements

Requirement Value
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

Bitmaps

Icons

DeleteObject

GetObject

BITMAP

CreateIcon

CreateIconFromResource

CreateIconIndirect

DestroyIcon

DrawIcon

DrawIconEx

LoadIcon

LookupIconIdFromDirectory

ICONINFO