Microsoft DirectX 8.0 (Visual Basic)

Direct3D8.CheckDeviceType

Verifies whether or not a certain device type can be used on this adapter and expect hardware acceleration using the given formats.

object.CheckDeviceType( _ 
    Adapter As Long, _ 
    CheckType As CONST_D3DDEVTYPE, _ 
    DisplayFormat As CONST_D3DFORMAT, _ 
    BackBufferFormat As CONST_D3DFORMAT, _ 
    bWindowed As Long) As Long

Parts

object
Object expression that resolves to a Direct3D8 object.
Adapter
Ordinal number denoting the display adapter to enumerate. D3DADAPTER_DEFAULT is always the primary display adapter. This method returns D3DERR_INVALIDCALL when this value equals or exceeds the number of display adapters in the system.
CheckType
Member of the CONST_D3DDEVTYPE enumeration, indicating the device type to check.
DisplayFormat
Member of the CONST_D3DFORMAT enumeration, indicating the format of the adapter display mode for which the device type is to be checked. For example, some devices operate only in 16-bits-per-pixel modes.
BackBufferFormat
Member of the CONST_D3DFORMAT enumeration, indicating the format of the adapter display mode for which the device type is to be checked. For example, some devices operate only in 16-bits-per-pixel modes.
bWindowed
Value indicating whether the device type will be used in full-screen or windowed mode. If set to True, the query is performed for windowed applications; otherwise, this value should be set False.

Return Values

If the device can be used on this adapter, D3D_OK is returned.

D3DERR_INVALIDCALL is returned if Adapter equals or exceeds the number of display adapters in the system. This method returns D3DERR_INVALIDDEVICE if CheckType specified a device that does not exist. D3DERR_NOTAVAILABLE is returned if either surface format is not supported, or if hardware acceleration is not available for the specified formats.

Error Codes

Err.Number is not set for this method.

Remarks

The most important device type that may not be present is D3DDEVTYPE_HAL. D3DDEVTYPE_HAL requires hardware acceleration. Applications should use CheckDeviceType to determine if the needed hardware and drivers are present on the system. The other device that may not be present is D3DDEVTYPE_SW. This device type represents a pluggable software device that was registered using Direct3D8.RegisterSoftwareDevice.

Applications should not specify a DisplayFormat that contains an alpha channel. This will result in a failed call. Note that an alpha channel may be present in the back buffer, but the two display formats must be identical in all other respects. For example, if DisplayFormat is D3DFMT_X1R5G5B5, valid values for BackBufferFormat include D3DFMT_X1R5G5B5 and D3DFMT_A1R5G5B5, but exclude D3DFMT_R5G6B5.

The following code fragment checks to see if the default adapter will handle RGB565 colors in windowed mode using hardware acceleration.

     Dim DisplayFormat As CONST_D3DFORMAT, BackBufferFormat As CONST_D3DFORMAT
     Dim IsWindowed As Long, bModeOK As Boolean, Check As Long
      
             DisplayFormat = D3DFMT_R5G6B5
             BackBufferFormat = D3DFMT_R5G6B5
     IsWindowed = 1     'TRUE
 
     Check = d3d.CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DisplayFormat, BackBufferFormat, IsWindowed)
     If (Check >= 0) Then
         bModeOK = True
     Else
         bModeOK = False
     End If