Platform SDK: DirectX

IDirectDraw7::GetSurfaceFromDC

The IDirectDraw7::GetSurfaceFromDC method retrieves the IDirectDrawSurface7 interface for a surface, based on its GDI device context handle.

HRESULT GetSurfaceFromDC(
  HDC hdc,
  LPDIRECTDRAWSURFACE7 * lpDDS
);

Parameters

hdc
Handle of a display device context.
lpDDS
Address of a variable to be filled with a valid IDirectDrawSurface7 interface pointer if the call succeeds.

Return Values

If the method succeeds, the return value is DD_OK.

If it fails, the method can return one of the following error values:

DDERR_GENERIC
DDERR_INVALIDPARAMS
DDERR_OUTOFMEMORY
DDERR_NOTFOUND

Remarks

This method succeeds only for device context handles that identify surfaces already associated with the DirectDraw object.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 98.
  Header: Declared in ddraw.h.

See Also

Surfaces and Device Contexts