Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
Retrieves a device context.
Syntax
HRESULT GetDC( HDC* phdc ); |
Parameters
- phdc
-
[out] Pointer to the device context for the surface.
Return Value
If the method succeeds, the return value is D3DM_OK (see D3DM Values).
If the method fails, the return value can be D3DMERR_INVALIDCALL (see D3DMERR Values).
Remarks
The following restrictions apply.
-
IDirect3DMobileSurface::GetDCis valid on the following
formats only: D3DMFMT_R5G6B5, D3DMFMT_X1R5G5B5, D3DMFMT_R8G8B8, and
D3DMFMT_X8R8G8B8. Formats that contain Alpha are not supported. For
more information, see
D3DMFORMAT.
- Only one device context per surface can be returned at a time.
-
IDirect3DMobileSurface::GetDCwill fail if the surface is
already locked. If the surface is a member of a mipmap,
IDirect3DMobileSurface::GetDCfails if any other mipmap
member is locked.
-
IDirect3DSurfaceMobile::GetDCfails on render targets unless
they were created lockable (or, in the case of back buffers, with
the
D3DMPRESENTFLAG_LOCKABLE_BACKBUFFERflag).
When a device context is outstanding on a surface, the application may not call these methods:
-
IDirect3DMobileDevice::ColorFill
-
IDirect3DMobileDevice::StretchRect
-
IDirect3DMobileDevice::UpdateTexture
-
IDirect3DMobileSurface::LockRect
-
IDirect3DMobileSwapChain::Present(on a swap chain that contains
the surface)
-
IDirect3DMobileTexture::LockRect
IDirect3DMobileSurface::GetDCcauses an implicit lock; do not retain the device context for later use. Call IDirect3DMobileSurface::ReleaseDCto release it.
It is valid to call IDirect3DMobileSurface::GetDCor IDirect3DMobileSurface::ReleaseDCon levels of a mipmap, however, these calls will be slow to all miplevels except the topmost level, and GDI operations to these miplevels will not be accelerated.
The handle to a device context (HDC) provides access to Microsoft Windows® and GDI functionality.
Requirements
Header | d3dm.h |
Library | D3dm.lib, D3dmguid.lib |
Windows Embedded CE | Windows CE 5.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |
See Also
Reference
IDirect3DMobileSurfaceD3DMFORMAT
D3DMPRESENTFLAG_LOCKABLE_BACKBUFFER
IDirect3DMobileDevice::ColorFill
IDirect3DMobileDevice::StretchRect
IDirect3DMobileDevice::UpdateTexture
IDirect3DMobileSurface::LockRect
IDirect3DMobileSwapChain::Present
IDirect3DMobileTexture::LockRect
IDirect3DMobileSurface::ReleaseDC