Microsoft Windows CE 3.0  

GetStockObject

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

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

HGDIOBJ
GetStockObject( int
fnObject
);

Parameters

fnObject
[in] Specifies the type of stock object. It is one of the following values.
Value Description
BLACK_BRUSH Black brush.
DKGRAY_BRUSH Dark gray brush.
GRAY_BRUSH Gray brush.
HOLLOW_BRUSH Hollow brush (equivalent to NULL_BRUSH).
LTGRAY_BRUSH Light gray brush.
NULL_BRUSH Null brush (equivalent to HOLLOW_BRUSH).
WHITE_BRUSH White brush.
BLACK_PEN Black pen.
WHITE_PEN White pen.
SYSTEM_FONT System font. By default, the system uses the system font to draw menus, dialog box controls, and text.
DEFAULT_PALETTE Default palette. This palette consists of the static colors in the system palette. Windows CE versions 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.

Remarks

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.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Wingdi.h   Mgbase.lib
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

DeleteObject, GetLastError, SelectObject