Microsoft DirectX 8.1 (Visual Basic)

Direct3D8.CreateDevice

Creates a device to represent the display adapter.

object.CreateDevice( _ 
    Adapter As Long, _ 
    DeviceType As CONST_D3DDEVTYPE, _ 
    hFocusWindow As Long, _ 
    BehaviorFlags As Long, _ 
    PresentationParameters As D3DPRESENT_PARAMETERS) As Direct3DDevice8

Parts

object
Object expression that resolves to a Direct3D8 object.
Adapter
Ordinal number that denotes the display adapter. D3DADAPTER_DEFAULT is always the primary display adapter.
DeviceType
Member of the CONST_D3DDEVTYPE enumeration. Denotes the desired device type. If the desired device type is not available, the method will fail.
hFocusWindow
Window handle to which focus belongs for this Direct3Ddevice. The window specified must be a top-level window for full-screen.
BehaviorFlags
A combination of one or more flags defined by the CONST_D3DCREATEFLAGS enumeration that control global behaviors of the Microsoft® Direct3D® device.
PresentationParameters
A D3DPRESENT_PARAMETERS type, describing the presentation parameters for the device to be created. Calling CreateDevice can change the value of the BackBufferCount member of D3DPRESENT_PARAMETERS; the back buffer count is changed to reflect a corrected number of back buffers.

Return Values

This method returns a Direct3DDevice8 object, representing the created device.

Error Codes

If the method fails, an error is raised and Err.Number can be set to one of the following values.

D3DERR_INVALIDCALL
D3DERR_NOTAVAILABLE
D3DERR_OUTOFVIDEOMEMORY

For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.

Remarks

This method returns a fully working device object, set to the required display mode (or windowed), and allocated with the appropriate back buffers. The application needs only to create and set a depth buffer, if desired, to begin rendering.

See Also

Direct3DDevice8.Reset, D3DDEVICE_CREATION_PARAMETERS