Microsoft KB Archive/139097

= How To How to Clean Up DirectDraw Using Release =

Article ID: 139097

Article Last Modified on 8/18/2005

-

APPLIES TO


 * Microsoft Game Software Development Kit (SDK)
 * Microsoft Windows XP Home Edition
 * Microsoft Windows XP Professional

-



This article was previously published under Q139097



SUMMARY
The DirectDraw object creates DirectDrawSurface, DirectDrawPalette, and DirectDrawClipper objects. Typically, an application or game will create the following at initialization time:
 * The main DirectDraw object.
 * A primary DirectDrawSurface with one or more back buffers that are attached to the primary surface and are DirectDrawSurfaces.
 * Other miscellaneous DirectDrawSurface(s) as needed.
 * DirectDrawPalette(s) to attach to a surface as needed.
 * DirectDrawClipper(s) to attach to a surface as needed.

At clean-up time, the application or game should call Release to release each object in reverse order of creation. A typical procedure to cleanup DirectDraw would follow this order:
 * Release all DirectDrawClipper(s).
 * Release all DirectDrawPalette(s).
 * Release all miscellaneous DirectDrawSurface(s).
 * Release the primary DirectDrawSurface.
 * Release the main DirectDraw object.

You don't need to release backbuffers explicitly because back buffers are attached to the primary surface, so they would be released with the primary buffer.

An application or game can also clean up DirectDraw using a single call to Release on the main DirectDraw object. The DirectDraw object, when released, will release all its associated surfaces, palettes, and clipper objects before going away.

Additional query words: 1.00 kbinf DDraw

Keywords: kbhowto kbdirectdraw kbfaq KB139097

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.