DrawIcon Function

The DrawIcon function draws an icon or cursor into the specified device context.

To specify additional drawing options, use the DrawIconEx function.

Syntax

BOOL DrawIcon(      
    HDC hDC,     int X,     int Y,     HICON hIcon );

Parameters

hDC
[in] Handle to the device context into which the icon or cursor will be drawn.
X
[in] Specifies the logical x-coordinate of the upper-left corner of the icon.
Y
[in] Specifies the logical y-coordinate of the upper-left corner of the icon.
hIcon
[in] Handle to the icon to be drawn.

Return Value

If the function succeeds, the return value is nonzero.

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

Remarks

DrawIcon places the icon's upper-left corner at the location specified by the X and Y parameters. The location is subject to the current mapping mode of the device context.

Example

For an example, see Displaying an Icon.

Function Information

Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systems Windows 95, Windows NT 3.1
UnicodeImplemented as Unicode version.

See Also

Tags :


Page view tracker