IDirect3DMobileSurface::GetDC
A version of this page is also available for
4/8/2010
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::GetDC is 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::GetDC will fail if the surface is already locked. If the surface is a member of a mipmap, IDirect3DMobileSurface::GetDC fails if any other mipmap member is locked.
- IDirect3DSurfaceMobile::GetDC fails on render targets unless they were created lockable (or, in the case of back buffers, with the D3DMPRESENTFLAG_LOCKABLE_BACKBUFFER flag).
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::GetDC causes an implicit lock; do not retain the device context for later use. Call IDirect3DMobileSurface::ReleaseDC to release it.
It is valid to call IDirect3DMobileSurface::GetDC or IDirect3DMobileSurface::ReleaseDC on 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
IDirect3DMobileSurface
D3DMFORMAT
D3DMPRESENTFLAG_LOCKABLE_BACKBUFFER
IDirect3DMobileDevice::ColorFill
IDirect3DMobileDevice::StretchRect
IDirect3DMobileDevice::UpdateTexture
IDirect3DMobileSurface::LockRect
IDirect3DMobileSwapChain::Present
IDirect3DMobileTexture::LockRect
IDirect3DMobileSurface::ReleaseDC