GetObject

Syntax

int GetObject(hObject,nCount,lpObject)

This function fills a buffer with the logical data that defines the logical object specified by the hObject parameter. The GetObject function copies the number of bytes of data specified by the nCount parameter to the buffer pointed to by the lpObject parameter.

The function retrieves data structures of the LOGPEN, LOGBRUSH, LOGFONT, or BITMAP type, or an integer, depending on the logical object. The buffer must be sufficiently large to receive the data.

If hObject specifies a bitmap, the function returns only the width, height, and color format information of the bitmap. The actual bits must be retrieved by using the GetBitmapBits function.

If hObject specifies a logical palette, it retrieves a two-byte value that specifies the number of entries in the palette; it does not retrieve the entire LOGPALETTE data structure that defines the palette. To get information on palette entries, an application must call the GetPaletteEntries function.

Parameter Type/Description  

hObject HANDLE Identifies a logical pen, brush, font, bitmap, or palette.  
nCount int Specifies the number of bytes to be copied to the buffer.  
lpObject LPSTR Points to the buffer that is to receive the information.  

Return Value

The return value specifies the actual number of bytes retrieved. It is zero if an error occurs.