CDC::DeleteDC

Syntax

BOOL DeleteDC();

Remarks

In general, do not call this function; the destructor will do it for you. The DeleteDC member function deletes the Windows function DC attached to the current CDC object. If this CDC object is the last active device context for a given device, the device is notified and all storage and system resources used by the device are released.

An application must not delete a device context whose handle was obtained by calling CWnd::GetDC. Instead, it must call CWnd::ReleaseDC to free the device context. The CClientDC class is provided to wrap this functionality.

The DeleteDC function is generally used to delete device contexts created with CreateDC, CreateIC, or CreateCompatibleDC.

Return Value

Specifies whether the device context has been deleted. TRUE if the device context is successfully deleted (regardless of whether the deleted device context is the last context for the device). FALSE if an error occurs.

See Also

CDC::CDC, CDC::~CDC, ::DeleteDC