Skip to content

Latest commit

 

History

History
122 lines (94 loc) · 5.53 KB

nf-dxgi-idxgisurface1-getdc.md

File metadata and controls

122 lines (94 loc) · 5.53 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:dxgi.IDXGISurface1.GetDC
IDXGISurface1::GetDC (dxgi.h)
Returns a device context (DC) that allows you to render to a Microsoft DirectX Graphics Infrastructure (DXGI) surface using Windows Graphics Device Interface (GDI).
GetDC
GetDC method [DXGI]
GetDC method [DXGI]
IDXGISurface1 interface
IDXGISurface1 interface [DXGI]
GetDC method
IDXGISurface1.GetDC
IDXGISurface1::GetDC
aa5d4cb4-dcad-b7fd-560c-12cc222965a0
direct3ddxgi.idxgisurface1_getdc
dxgi/IDXGISurface1::GetDC
direct3ddxgi\idxgisurface1_getdc.htm
direct3ddxgi
b148d2b4-36a2-46b9-8a98-9f3c478549a4
12/05/2018
GetDC, GetDC method [DXGI], GetDC method [DXGI],IDXGISurface1 interface, IDXGISurface1 interface [DXGI],GetDC method, IDXGISurface1.GetDC, IDXGISurface1::GetDC, aa5d4cb4-dcad-b7fd-560c-12cc222965a0, direct3ddxgi.idxgisurface1_getdc, dxgi/IDXGISurface1::GetDC
dxgi.h
Windows
Windows 7 [desktop apps \| UWP apps]
Windows Server 2008 R2 [desktop apps \| UWP apps]
DXGI.lib
Windows
19H1
IDXGISurface1::GetDC
dxgi/IDXGISurface1::GetDC
c++
APIRef
kbSyntax
COM
DXGI.lib
DXGI.dll
IDXGISurface1.GetDC

IDXGISurface1::GetDC

-description

Returns a device context (DC) that allows you to render to a Microsoft DirectX Graphics Infrastructure (DXGI) surface using Windows Graphics Device Interface (GDI).

-parameters

-param Discard

Type: BOOL

A Boolean value that specifies whether to preserve Direct3D contents in the GDI DC. TRUE directs the runtime not to preserve Direct3D contents in the GDI DC; that is, the runtime discards the Direct3D contents. FALSE guarantees that Direct3D contents are available in the GDI DC.

-param phdc [out]

Type: HDC*

A pointer to an HDC handle that represents the current device context for GDI rendering.

-returns

Type: HRESULT

Returns S_OK if successful; otherwise, an 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).

After you use the GetDC method to retrieve a DC, you can render to the DXGI surface by using GDI.
The GetDC method readies the surface for GDI rendering and allows inter-operation between DXGI and GDI technologies.

Keep the following in mind when using this method:

You can also call GetDC on the back buffer at index 0 of a swap chain by obtaining an IDXGISurface1 from the swap chain. The following code illustrates the process.

IDXGISwapChain* g_pSwapChain = NULL;
IDXGISurface1* g_pSurface1 = NULL;
...
//Setup the device and the swapchain
g_pSwapChain->GetBuffer(0, __uuidof(IDXGISurface1), (void**) &g_pSurface1);
g_pSurface1->GetDC( FALSE, &g_hDC );
...      
//Draw on the DC using GDI
...
//When finish drawing release the DC
g_pSurface1->ReleaseDC( NULL );
      

-see-also

DXGI Interfaces

IDXGISurface1