Collapse the table of content
Expand the table of content

GetStockObject (Windows CE 5.0)

Windows CE 5.0
Send Feedback

This function retrieves a handle to one of the predefined stock pens, brushes or fonts.

HGDIOBJ GetStockObject(
  int fnObject


[in] Specifies the type of stock object. It is one of the following values.
BLACK_BRUSHBlack brush.
DKGRAY_BRUSHDark gray brush.
GRAY_BRUSHGray brush.
HOLLOW_BRUSHHollow brush (equivalent to NULL_BRUSH).
LTGRAY_BRUSHLight gray brush.
NULL_BRUSHNull brush (equivalent to HOLLOW_BRUSH).
WHITE_BRUSHWhite brush.
BLACK_PENBlack pen.
WHITE_PENWhite pen.
NULL_PENNull pen.
SYSTEM_FONTSystem font.

By default, the system uses the system font to draw menus, dialog box controls, and text.

DEFAULT_PALETTEDefault palette.

This palette consists of the static colors in the system palette.

Windows CE 1.0 and 1.01 do not support this value.

Return Values

If the function succeeds, the return value identifies the logical object requested. NULL indicates failure. To get extended error information, call GetLastError.


Use the DKGRAY_BRUSH, GRAY_BRUSH, and LTGRAY_BRUSH stock objects only in windows with the CS_HREDRAW and CS_VREDRAW styles.

Using a gray stock brush in any other style of window can lead to misalignment of brush patterns after a window is moved or sized. The origins of stock brushes cannot be adjusted.

The HOLLOW_BRUSH and NULL_BRUSH stock objects are equivalent.

It is not necessary (but it is not harmful) to delete stock objects by calling DeleteObject.


OS Versions: Windows CE 1.0 and later.
Header: Windows.h.
Link Library: Coredll.lib.

See Also

DeleteObject | SelectObject | GDI Functions

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.

© 2016 Microsoft