DirectX SDK

DirectDraw7.CreateSurfaceFromFile

The DirectDraw7.CreateSurfaceFromFile method creates a DirectDrawSurface7 object for this DirectDraw object and attaches the specified bitmap image to the DirectDrawSurface object.

object.CreateSurfaceFromFile( _ 
    file As String, _ 
    dd As DDSURFACEDESC2) As DirectDrawSurface7

Parameters

object
Object expression that resolves to a DirectDraw7 object.
file
Name of the bitmap image to load onto the surface that is created.
dd
DDSURFACEDESC2 type that describes the requested surface. A DDSCAPS2 type is a member of DDSURFACEDESC2.

Return Values

If the method succeeds, it returns a DirectDrawSurface7 object.

Error Codes

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

DDERR_INCOMPATIBLEPRIMARY
DDERR_INVALIDCAPS
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_INVALIDPIXELFORMAT
DDERR_NOALPHAHW
DDERR_NOCOOPERATIVELEVELSET
DDERR_NODIRECTDRAWHW
DDERR_NOEMULATION
DDERR_NOEXCLUSIVEMODE
DDERR_NOFLIPHW
DDERR_NOMIPMAPHW
DDERR_NOOVERLAYHW
DDERR_NOZBUFFERHW
DDERR_OUTOFMEMORY
DDERR_OUTOFVIDEOMEMORY
DDERR_PRIMARYSURFACEALREADYEXISTS
DDERR_UNSUPPORTEDMODE

Remarks

If you are using 256 colors, set the display mode and the palette before you call this method to display correct palette information.