Platform SDK: DirectX

Direct3D7.CreateDevice

The Direct3D7.CreateDevice method creates a Direct3D device to be used with the DrawPrimitive methods.

object.CreateDevice( _ 
    guid As String, _ 
    surf As DirectDrawSurface7) As Direct3DDevice7

Parameters

object
Object expression that resolves to a Direct3D7 object.
guid
Guid for the new device. This value can be an enumerated GUID string or the "IID_Direct3DHALDevice" or "IID_Direct3DRGBDevice" string constants. The method also accepts "IID_Direct3DRefDevice" which creates the reference device, for use in testing or feature demonstration.
surf
A DirectDrawSurface7 object for the DirectDrawSurface object that will be the device's rendering target. The surface must have been created as a 3-D device by using the DDSCAPS_3DDEVICE capability.

Return Values

If the method succeeds, the return value is a reference to a Direct3DDevice7 object.

Error Codes

If the method fails, an error is raised and Err.Number may be set to DDERR_INVALIDPARAMS if one of the parameters is invalid.

Remarks

All rendering devices created by a given Direct3D7 object share the same physical resources. Although your application can create multiple rendering devices from a single Direct3D7 object, because they share the same hardware, extreme performance penalties will be incurred.

When you call Direct3D7.CreateDevice, you create a device object that is separate from a DirectDraw surface object. This device uses a DirectDraw surface as a rendering target.

See Also

Direct3DDevice7, Creating a Direct3D Device, Direct3D Devices