IDXGISurface1::ReleaseDC method (dxgi.h)

Releases the GDI device context (DC) that is associated with the current surface and allows you to use Direct3D to render.

Syntax

HRESULT ReleaseDC(
  [in, optional] RECT *pDirtyRect
);

Parameters

[in, optional] pDirtyRect

Type: RECT*

A pointer to a RECT structure that identifies the dirty region of the surface.
A dirty region is any part of the surface that you used for GDI rendering and that you want to preserve. This area is used as a performance hint to graphics subsystem in certain scenarios. Do not use this parameter to restrict rendering to the specified rectangular region. If you pass in NULL, ReleaseDC considers the whole surface as dirty. Otherwise, ReleaseDC uses the area specified by the RECT as a performance hint to indicate what areas have been manipulated by GDI rendering.

You can pass a pointer to an empty RECT structure (a rectangle with no position or area) if you didn't change any content.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

This method is not supported by DXGI 1.0, which shipped in Windows Vista and Windows Server 2008. DXGI 1.1 support is required, which is available on Windows 7, Windows Server 2008 R2, and as an update to Windows Vista with Service Pack 2 (SP2) (KB 971644) and Windows Server 2008 (KB 971512).

Use the ReleaseDC method to release the DC and indicate that your application finished all GDI rendering to this surface.
You must call the ReleaseDC method before you can use Direct3D to perform additional rendering.

Prior to resizing buffers you must release all outstanding DCs.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header dxgi.h
Library DXGI.lib

See also

DXGI Interfaces

IDXGISurface1