GDI Objects

GDI objects support only one handle per object. Handles to GDI objects are private to a process. That is, only the process that created the GDI object can use the object handle. A single process may have no more than 16,384 open GDI object handles.

The following table lists the GDI objects, along with each object's creator and destroyer functions. The creator functions either create the object and an object handle or simply return the existing object handle. The destroyer functions remove the object from memory, which invalidates the object handle.

GDI Objects

Object Creator function Destroyer function
Bitmap CreateBitmap, CreateBitmapIndirect, CreateCompatibleBitmap, CreateDIBitmap, CreateDIBSection, CreateDiscardableBitmap DeleteObject
Brush CreateBrushIndirect, CreateDIBPatternBrush, CreateDIBPatternBrushPt, CreateHatchBrush, CreatePatternBrush, CreateSolidBrush DeleteObject
DC CreateDC DeleteDC, ReleaseDC
Enhanced metafile CreateEnhMetaFile DeleteEnhMetaFile
Enhanced-metafile DC CreateEnhMetaFile CloseEnhMetaFile
Font CreateFont, CreateFontIndirect DeleteObject
Memory DC CreateCompatibleDC DeleteDC
Metafile CreateMetaFile DeleteMetaFile
Metafile DC CreateMetaFile CloseMetaFile
Palette CreatePalette DeleteObject
Pen and extended pen CreatePen, CreatePenIndirect, ExtCreatePen DeleteObject
Region CombineRgn, CreateEllipticRgn, CreateEllipticRgnIndirect, CreatePolygonRgn, CreatePolyPolygonRgn, CreateRectRgn, CreateRectRgnIndirect, CreateRoundRectRgn, ExtCreateRegion, PathToRegion DeleteObject