Platform SDK: DirectX

DirectDrawSurface7.GetDC

The DirectDrawSurface7.GetDC method creates a GDI-compatible handle of a device context for the surface.

object.GetDC() As Long

Parameters

object
Object expression that resolves to a DirectDrawSurface7 object.

Return Values

If the method succeeds, it returns the handle to a device context.

Error Codes

If the method fails, it raises an error, and Err.Number can be set to one of the following values:

DDERR_DCALREADYCREATED
DDERR_GENERIC
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_INVALIDSURFACETYPE
DDERR_SURFACELOST
DDERR_UNSUPPORTED
DDERR_WASSTILLDRAWING

Remarks

This method uses an internal version of the DirectDrawSurface7.Lock method to lock the surface. The surface remains locked until the DirectDrawSurface7.ReleaseDC method is called.

ReleaseDC must be called from the same thread that called GetDC.

See Also

DirectDrawSurface7.Lock