DirectX SDK

DirectDraw7.CreateSurfaceFromResource

The DirectDraw7.CreateSurfaceFromResource method creates a DirectDrawSurface7 object for this DirectDraw object and attaches the specified resource to the DirectDrawSurface object.

object.CreateSurfaceFromResource( _ 
    file As String, _ 
    resName As String, _ 
    ddsd As DDSURFACEDESC2) As DirectDrawSurface7

Parameters

object
Object expression that resolves to a DirectDraw7 object.
file
Filename of the resource that is loaded onto the surface that is created. If the resource is part of the executable, specifying an empty string for this parameter locates the resource. This parameter can also be the name of an OCX in which the resource is located.
resName
Name of the resource that is loaded onto the surface that is created.
ddsd
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 supply an empty string as the module name and run the application in the Microsoft® Visual Basic® environment, the resource cannot be found. Passing an empty string succeeds only if you are using a stand-alone executable.

The resource name needs to be a string, rather than a number. Place quotes around the resource name to make it a string, or the method fails.