Retrieves a device context.
HRESULT GetDC( HDC* phdc );
If the method succeeds, the return value is D3D_OK. D3DERR_INVALIDCALL is returned if the argument is invalid.
The following restrictions apply.
When a device context is outstanding on a surface, the application may not call these methods:
IDirect3DCubeTexture9 | IDirect3DCubeTexture9::LockRect |
IDirect3DDevice9 | IDirect3DDevice9::ColorFill |
IDirect3DDevice9::StretchRect | |
IDirect3DDevice9::UpdateSurface | |
IDirect3DDevice9::UpdateTexture | |
IDirect3DSurface9 | IDirect3DSurface9::LockRect |
IDirect3DSwapChain9 | IDirect3DSwapChain9::Present * |
IDirect3DTexture9 | IDirect3DTexture9::LockRect |
* (on a swap chain that contains the surface)
IDirect3DSurface9::GetDC causes an implicit lock; do not retain the device context for later use. Call IDirect3DSurface9::ReleaseDC to release it.
It is valid to call IDirect3DSurface9::GetDC/IDirect3DSurface9::ReleaseDC on levels of a mipmap or cubemap, however, these calls will be slow to all miplevels except the topmost level, and GDI operations to these miplevels will not be accelerated.
The hdc provides access to Win32 and GDI functionality.
Header: Declared in D3d9.h.
IDirect3DSurface9::ReleaseDC, D3DUSAGE, D3DPOOL, D3DPRESENT_PARAMETERS