DeleteObject

Syntax

BOOL DeleteObject(hObject)

This function deletes a logical pen, brush, font, bitmap, region, or palette from memory by freeing all system storage associated with the object. After the object is deleted, the hObject handle is no longer valid.

Parameter Type/Description  

hObject HANDLE Identifies a handle to a logical pen, brush, font, bitmap, region, or palette.  

Return Value

The return value specifies whether the specified object is deleted. It is nonzero if the object is deleted. It is zero if the hObject parameter is not a valid handle or is currently selected into a device context.

Comments

The object to be deleted should not be currently selected into a device context.

When a pattern brush is deleted, the bitmap associated with the brush is not deleted. The bitmap must be deleted independently.

An application must not delete a stock object.