int GetObject(hgdiobj, cbBuffer, lpvObject) | |||||
HGDIOBJ hgdiobj; | /* handle of object, */ | ||||
int cbBuffer; | /* size of buffer for object information | */ | |||
void FAR* lpvObject; | /* address of buffer for object information | */ |
The GetObject function fills a buffer with information that defines a given object. The function retrieves a LOGPEN, LOGBRUSH, LOGFONT, or BITMAP structure, or an integer, depending on the specified object.
hgdiobj
Identifies a logical pen, brush, font, bitmap, or palette.
cbBuffer
Specifies the number of bytes to be copied to the buffer.
lpvObject
Points to the buffer that is to receive the information.
The return value specifies the number of bytes retrieved if the function is successful. Otherwise, it is zero.
The buffer pointed to by the lpvObject 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 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.
The following example uses the GetObject function to fill a LOGBRUSH structure with the attributes of the current brush and then tests whether the brush style is BS_SOLID:
LOGBRUSH
lb; HBRUSH hbr; GetObject(hbr, sizeof(LOGBRUSH), (LPSTR) &lb); if (lb.lbStyle == BS_SOLID) { . . . }