导航:[首页]->[wingui]->[Gdi对象释放对照表]

 

Gdi对象释放对照表

Resource Allocation Routine Cleanup Routine Cleanup Required?  
Accelerators LoadAccelerators N/A No  
         
Atoms GlobalAddAtom GlobalFreeAtom Yes  
         
Bitmaps CreateBitmap DeleteObject Yes *
  CreateBitmapIndirect DeleteObject Yes *
  CreateCompatibleBitmap DeleteObject Yes *
  CreateDIBitmap DeleteObject Yes *
  CreateDiscardableBitmap DeleteObject Yes *
  LoadBitmap DeleteObject Yes *
         
Brushes CreateBrushIndirect DeleteObject Yes  
  CreateDIBPatternBrush DeleteObject Yes  
  CreateHatchBrush DeleteObject Yes  
  CreatePatternBrush DeleteObject Yes  
  CreateSolidBrush DeleteObject Yes  
         
Carets CreateCaret DestroyCaret No #
         
Clipboard OpenClipboard CloseClipboard Yes  
         
Comms Ports OpenComm CloseComm Yes
         
Cursor CreateCursor DestroyCursor Yes  
  LoadCursor N/A No  
         
DC CreateDC DeleteDC Yes  
  CreateCompatibleDC DeleteDC Yes @
  GetDC ReleaseDC Yes  
  GetWindowDC ReleaseDC Yes  
  BeginPaint EndPaint Yes  
         
Dialog Box CreateDialog DestroyWindow No
  CreateDialogIndirect DestroyWindow No  
  CreateDialogIndirectParam DestroyWindow No  
  CreateDialogParam DestroyWindow No  
         
File OpenFile _lclose No  
         
Fonts CreateFont DeleteObject Yes  
  CreateFontIndirect DeleteObject Yes  
  AddFontResource RemoveFontResource Yes  
         
GDI Stock Obj GetStockObject N/A No &
         
Hook SetWindowsHook UnhookWindowsHook Yes  
         
IC CreateIC DeleteDC Yes  
         
Icon CreateIcon DestroyIcon Yes  
  LoadIcon N/A No  
         
Library LoadLibrary FreeLibrary Yes  
         
Memory AllocDStoCSAlias FreeSelector Yes  
  AllocSelector FreeSelector Yes  
  GlobalAlloc GlobalFree No  
  GlobalDOSAlloc GlobalDOSFr No  
  GlobalFix GlobalUnfix No  
  GlobalLock GlobalUnlock No  
  GlobalPageLock GlobalPageUnlock No  
  GlobalRealloc GlobalFree No  
  GlobalWire GlobalUnwire No  
  LocalAlloc LocalFree No  
  LocalLock LocalUnlock No  
  LocalRealloc LocalFree No  
         
Menu CreateMenu DestroyMenu No %
  CreatePopupMenu DestroyMenu No %
  LoadMenu DestroyMenu No %
  LoadMenuIndirect DestroyMenu No %
  GetSystemMenu N/A No  
         
MetaFile CreateMetaFile DeleteMetaFile Yes  
         
Palette CreatePalette DeleteObject Yes  
         
Pen CreatePen DeleteObject Yes  
  CreatePenIndirect DeleteObject Yes  
         
Regions CreateEllipticRgn DeleteObject Yes  
  CreateEllipticRgnIndirect DeleteObject Yes  
  CreatePolygonRgn DeleteObject Yes  
  CreatePolyPolygonRgn DeleteObject Yes  
  CreateRectRgn DeleteObject Yes  
  CreateRectRgnIndirect DeleteObject Yes  
  CreateRoundRectRgn DeleteObject Yes  
         
Resource AllocResource FreeResource No  
  FindResource N/A No  
  LoadResource FreeResource No  
  LockResource UnlockResource No  
         
Sound OpenSound CloseSound Yes  
         
String LoadString N/A No  
         
Thunk MakeProcInstance FreeProcInstance No  
         
Timer SetTimer KillTimer No  
         
Window CreateWindow DestroyWindow No  
  CreateWindowEx DestroyWindow No  

 Notes:
------

  • Bitmaps must be disconnected from a DC before being freed.
% Menus must be freed before an application exits if the menu is not
connected to any window.
@ A DC must be disconnected from bitmaps before being freed.
# If a bitmap is specified for the Caret, it must be freed.
& Calls to DeleteObject do not harm stock objects.

 

参考:

http://www.cnblogs.com/want/archive/2010/10/24/1859905.html

http://www.quackit.com/html/online-html-editor/