GetCurrentObject function (wingdi.h)

The GetCurrentObject function retrieves a handle to an object of the specified type that has been selected into the specified device context (DC).

Syntax

HGDIOBJ GetCurrentObject(
  [in] HDC  hdc,
  [in] UINT type
);

Parameters

[in] hdc

A handle to the DC.

[in] type

The object type to be queried. This parameter can be one of the following values.

Value Meaning
OBJ_BITMAP
Returns the current selected bitmap.
OBJ_BRUSH
Returns the current selected brush.
OBJ_COLORSPACE
Returns the current color space.
OBJ_FONT
Returns the current selected font.
OBJ_PAL
Returns the current selected palette.
OBJ_PEN
Returns the current selected pen.

Return value

If the function succeeds, the return value is a handle to the specified object.

If the function fails, the return value is NULL.

Remarks

An application can use the GetCurrentObject and GetObject functions to retrieve descriptions of the graphic objects currently selected into the specified DC.

Examples

For an example, see Retrieving Graphic-Object Attributes and Selecting New Graphic Objects.

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 wingdi.h (include Windows.h)
Library Gdi32.lib
DLL Gdi32.dll

See also

CreateColorSpace

DeleteObject

Device Context Functions

Device Contexts Overview

GetObject

SelectObject