DirectX SDK

DirectDraw7.GetFreeMem

The DirectDraw7.GetFreeMem method retrieves the total amount of display memory currenty free.

object.GetFreeMem(ddsCaps As DDSCAPS2) As Long

Parameters

object
Object expression that resolves to a DirectDraw7 object.
ddsCaps
DDSCAPS2 type that indicates the hardware capabilities of the proposed surface.

Return Values

If the method succeds, it returns the total amount of memory.

Error Codes

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

DDERR_INVALIDCAPS
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_NODIRECTDRAWHW

Remarks

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, you should use the free-memory value only as an approximation. In addition, a particular display adapter card might make no distinction between two different memory types. For example, the adapter might use the same portion of display memory to store z-buffers and textures. So, allocating one type of surface (for example, a z-buffer) can affect the amount of display memory available for another type of surface (textures). Therefore, it is best to first allocate an application's fixed resources (such as front and back buffers , and z-buffers) before determining how much memory is available for dynamic use (such as texture mapping).