IDirect3D2::CreateDevice

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

HRESULT CreateDevice(
  REFCLSID rclsid,                    
  LPDIRECTDRAWSURFACE lpDDS,          
  LPDIRECT3DDEVICE2 * lplpD3DDevice2  
);
 

Parameters

rclsid
Class identifier for the new device. This can be IID_IDirect3DHALDevice, IID_IDirect3DMMXDevice, IID_IDirect3DRampDevice, or IID_IDirect3DRGBDevice.
lpDDS
Address of a DirectDraw surface that describes the new device.
lplpD3DDevice2
Address that points to the new IDirect3DDevice2 interface when the method returns.

Return Values

If the method succeeds, the return value is DD_OK.

If the method fails, the return value is an error. The method returns DDERR_INVALIDPARAMS if one of the arguments is invalid.

Remarks

This method was introduced with the IDirect3D2 interface. In previous versions of Direct3D, devices could be created only by calling the IDirectDrawSurface::QueryInterface method; devices created in this manner can only be used with execute buffers.

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

QuickInfo

  Windows NT: Use version 5.0 or later.
  Windows: Use Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Header: Declared in ddraw.h.
  Import Library: Use ddraw.lib.