GetObject

  int GetObject(hgdiobj, cbBuffer, lpvObject)    
  HGDIOBJ hgdiobj; /* handle of object */
  int cbBuffer; /* size of buffer for object information */
  LPVOID lpvObject; /* address of buffer for object information */

The GetObject function fills a buffer with information that defines a given object. The function retrieves a BITMAP, EXTLOGPEN, LOGPEN, LOGBRUSH, or LOGFONT structure, or an integer, depending on the specified object.

Parameters

hgdiobj

Identifies a logical bitmap, brush, font, palette, or pen .

cbBuffer

Specifies the number of bytes to be copied to the buffer.

lpvObject

Points to the buffer that is to receive the information. If NULL, then the return value contains the number of bytes needed for the logical object.

Return Value

The return value specifies the actual number of bytes retrieved, or the number of bytes needed to hold the object if lpvObject was NULL. It is zero if an error occurs.

Comments

The buffer pointed to by the lpvvObject parameter must be sufficiently large to receive the information.

If the hgdiobj parameter identifies a bitmap, the GetObject function returns only the width, height, and color format information of the bitmap. The bits can be retrieved by using the GetBitmapBits function.

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

See Also

GetDIBits, GetPaletteEntries