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.
A version of this page is also available for
4/8/2010

This method retrieves the total amount of display memory available and the amount of display memory currently free for a given type of surface.

Syntax

HRESULT GetAvailableVidMem( 
  LPDDSCAPS 
lpDDSCaps, 
  LPDWORD 
lpdwTotal, 
  LPDWORD 
lpdwFree
);

Parameters

lpDDSCaps

Address of a DDSCAPSstructure that indicates the hardware capabilities of the proposed surface.

lpdwTotal

Address of a variable that will be filled with the total amount of display memory available, in bytes. The value retrieved reflects the total video memory, less the video memory required for the primary surface and any private caches the display driver reserves.

lpdwFree

Address of a variable that will be filled with the amount of display memory currently free that can be allocated for a surface that matches the capabilities specified by the structure at lpDDSCaps.

Return Value

If the method succeeds, the return value is DD_OK.

If the method fails, the return value may be one of the following error values:

DDERR_INVALIDCAPS

DDERR_INVALIDOBJECT

DDERR_INVALIDPARAMS

DDERR_UNSUPPORTED

For more information on these error codes see DirectDraw Return Values.

Remarks

If NULL is passed to either lpdwTotalor lpdwFree, the value for that parameter is not returned.

This method provides only a snapshot of the current display-memory state.

The amount of free display memory is subject to change as surfaces are created and released. Therefore, use the free memory value only as an approximation.

In addition, a particular display adapter card may make no distinction between two different memory types.

This method might not be supported on some drivers. In this case, the method will return DDERR_UNSUPPORTED.

Requirements

Header ddraw.h
Library ddraw.lib
Windows Embedded CE Windows Embedded CE 6.0 and later
Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later