Microsoft Windows CE 3.0  

GetObject

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 obtains information about a specified graphics object. Depending on the graphics object, the function places a filled-in BITMAP, DIBSECTION, LOGBRUSH, LOGFONT, or LOGPENstructure into a specified buffer.

int
GetObject( HGDIOBJ
hgdiobj
, int
cbBuffer
, LPVOID
lpvObject
);

Parameters

hgdiobj
[in] Handle to the graphics object of interest. This can be a handle to one of the following: a logical bitmap, a brush, a font, a palette, a pen, or a device-independent bitmap created by calling the CreateDIBSectionfunction.
cbBuffer
[in] Specifies the number of bytes of information to be written to the buffer.
lpvObject
[out] Long pointer to a buffer that is to receive the information about the specified graphics object.

The following table shows the type of information the buffer receives for each type of graphics object you can specify with hgdiobj.

Object type Data written to * lpvObject
HBITMAP BITMAP
HBITMAPreturned from a call to CreateDIBSection DIBSECTION, if cbBufferis set to sizeof( DIBSECTION), or BITMAP, if cbBufferis set to sizeof( BITMAP)
HPALETTE A WORDcount of the number of entries in the logical palette
HPEN LOGPEN
HBRUSH LOGBRUSH
HFONT LOGFONT

If the lpvObjectparameter is NULL, the function return value is the number of bytes required to store the information it writes to the buffer for the specified graphics object.

For Windows CE versions 1.0 and 1.01:

  • The HPALETTEobject type is not supported.
  • GetObjectalways returns a BITMAPwhen it is used on a DIB section.

    Return Values

    If the function succeeds, and lpvObjectis a valid pointer, the return value is the number of bytes stored into the buffer.

    If the function succeeds, and lpvObjectis NULL, the return value is the number of bytes required to hold the information the function would store into the buffer.

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

    Remarks

    The buffer pointed to by the lpvObjectparameter must be sufficiently large to receive the information about the graphics object.

    If hgdiobjidentifies a bitmap created by calling CreateDIBSection, and the specified buffer is large enough, the GetObjectfunction returns a DIBSECTIONstructure. In addition, the bmBitsmember of the BITMAPstructure contained within the DIBSECTIONwill contain a pointer to the bitmap's bit values.

    If hgdiobjidentifies a bitmap created by any other means, GetObjectreturns only the width, height, and color format information of the bitmap.

    If hgdiobjidentifies a logical palette, GetObjectretrieves a 2-byte integer that specifies the number of entries in the palette. The function does not retrieve the LOGPALETTEstructure defining the palette. To retrieve information about palette entries, an application can call the GetPaletteEntriesfunction.

    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

    CreateDIBSection, GetLastError, GetObject, GetPaletteEntries, GetRegionData, BITMAP, DIBSECTION, LOGBRUSH, LOGFONT, LOGPALETTE, LOGPEN