DeleteObject

  BOOL DeleteObject(hObject)    
  HGDIOBJ hObject;    

The DeleteObject function deletes a logical pen, brush, font, bitmap, region or palette, freeing all system resources associated with the object. After the object is deleted, the hObject handle is no longer valid.

Parameters

hObject

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

Return Value

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

Comments

The object to be deleted must 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.