GetObject Home
Microsoft Windows CE .NET 4.2
GetObject

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 LOGPEN structure 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 CreateDIBSection function.
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
HBITMAP returned from a call to CreateDIBSection DIBSECTION, if cbBuffer is set to sizeof(DIBSECTION), or BITMAP, if cbBuffer is set to sizeof(BITMAP)
HPALETTE A WORD count of the number of entries in the logical palette
HPEN LOGPEN
HBRUSH LOGBRUSH
HFONT LOGFONT

If the lpvObject parameter 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 HPALETTE object type is not supported.
  • GetObject always returns a BITMAP when it is used on a DIB section.

Return Values

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

If the function succeeds, and lpvObject is 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 lpvObject parameter must be sufficiently large to receive the information about the graphics object.

If hgdiobj identifies a bitmap created by calling CreateDIBSection, and the specified buffer is large enough, the GetObject function returns a DIBSECTION structure. In addition, the bmBits member of the BITMAP structure contained within the DIBSECTION will contain a pointer to the bitmap's bit values.

If hgdiobj identifies a bitmap created by any other means, GetObject returns only the width, height, and color format information of the bitmap.

If hgdiobj identifies a logical palette, GetObject retrieves a 2-byte integer that specifies the number of entries in the palette. The function does not retrieve the LOGPALETTE structure defining the palette. To retrieve information about palette entries, an application can call the GetPaletteEntries function.

Requirements

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

See Also

CreateDIBSection | GetObject | GetPaletteEntries | GetRegionData | BITMAP | DIBSECTION | LOGBRUSH | LOGFONT | LOGPALETTE | LOGPEN | GDI Functions


Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View