Manager.CheckDeviceType Method
Specifies whether a hardware-accelerated device type can be used on the current adapter.
Namespace: Microsoft.WindowsMobile.DirectX.Direct3D
Assembly: Microsoft.WindowsMobile.DirectX (in Microsoft.WindowsMobile.DirectX.dll)
Syntax
'Declaration
Public Shared Function CheckDeviceType ( _
adapter As Integer, _
checkType As DeviceType, _
displayFormat As Format, _
backBufferFormat As Format, _
windowed As Boolean _
) As Boolean
'Usage
Dim adapter As Integer
Dim checkType As DeviceType
Dim displayFormat As Format
Dim backBufferFormat As Format
Dim windowed As Boolean
Dim returnValue As Boolean
returnValue = Manager.CheckDeviceType(adapter, _
checkType, displayFormat, backBufferFormat, _
windowed)
public static bool CheckDeviceType(
int adapter,
DeviceType checkType,
Format displayFormat,
Format backBufferFormat,
bool windowed
)
public:
static bool CheckDeviceType(
int adapter,
DeviceType checkType,
Format displayFormat,
Format backBufferFormat,
bool windowed
)
public static function CheckDeviceType(
adapter : int,
checkType : DeviceType,
displayFormat : Format,
backBufferFormat : Format,
windowed : boolean
) : boolean
Parameters
adapter
Type: System.Int32Ordinal number that denotes the display adapter to query. AdapterListCollection.Default is always the primary display adapter.
checkType
Type: Microsoft.WindowsMobile.DirectX.Direct3D.DeviceTypeMember of the DeviceType enumeration that identifies the device type.
displayFormat
Type: Microsoft.WindowsMobile.DirectX.Direct3D.FormatMember of the Format enumeration that indicates the format of the adapter display mode for which the device type is being checked. For example, some devices operate only in modes of 16 bits per pixel.
backBufferFormat
Type: Microsoft.WindowsMobile.DirectX.Direct3D.FormatBack buffer format. For more information about formats, see Format. This value must be one of the render target formats. The DisplayMode property of a Device can be used to obtain the current format. For windowed applications, the back buffer format does not need to match the display mode format if the hardware supports color conversion. The set of possible back buffer formats is constrained, but the runtime allows any valid back buffer format to be presented to any desktop format. Additionally, the device must be operable in desktop mode because devices typically do not operate in modes of 8 bits per pixel.
Full-screen applications cannot perform color conversion. You can specify Unknown of the Format for windows mode.
windowed
Type: System.BooleanSet to true to inquire about windowed multisampling. Set to false to inquire about full-screen multisampling.
Return Value
Type: System.Boolean
true if the method succeeds and the device can be used on this adapter; otherwise, false.
Remarks
A hardware abstraction layer (HAL) device type requires hardware acceleration. Applications that can use the CheckDeviceType method to support a HAL device are present.
Full-screen applications should not specify a displayFormat that contains an alpha channel; doing so will result in a failed call. Note that an alpha channel can be present in the back buffer, but the two display formats must be identical in all other respects. For example, if displayFormat = X1R5G5B5, valid values for backBufferFormat include X1R5G5B5 and A1R5G5B5 but exclude R5G6B5.
Examples
The following code example shows whether a certain device type can be used on the adapter.
Public Sub CheckDeviceType()
' Test some formats
IsDeviceTypeOK(Format.X8R8G8B8, Format.A8R8G8B8)
If result <> Fix(ResultCode.Success) Then
System.Windows.Forms.MessageBox.Show(String.Format("The device check failed: {0}", result))
End If
End Sub
Public Function IsDeviceTypeOK(ByVal displayFmt As Format, ByVal backbufferFmt As Format) As Boolean
Dim ai As AdapterInformation = Microsoft.WindowsMobile.DirectX.Direct3D.Manager.Adapters.Default
' Verify that the device can be used on the default adapter with the given surface format
If Microsoft.WindowsMobile.DirectX.Direct3D.Manager.CheckDeviceType(ai.Adapter, DeviceType.Default, displayFmt, backbufferFmt, False) Then
Return True ' if the call succeeds
End If
Return False
' otherwise fail. NOTE: HRESULT passed back in result
End Function
public void CheckDeviceType()
{
// Test some formats
IsDeviceTypeOK(Format.X8R8G8B8, Format.A8R8G8B8);
if (result != (int)ResultCode.Success)
System.Windows.Forms.MessageBox.Show(String.Format("The device check failed: {0}", result));
}
public bool IsDeviceTypeOK(Format displayFmt, Format backbufferFmt)
{
AdapterInformation ai = Microsoft.WindowsMobile.DirectX.Direct3D.Manager.Adapters.Default;
// Verify that the device can be used on the default adapter with the given surface format
if (Microsoft.WindowsMobile.DirectX.Direct3D.Manager.CheckDeviceType(ai.Adapter, DeviceType.Default, displayFmt, backbufferFmt, false))
{
return true; // if the call succeeds
}
return false; // otherwise fail. NOTE: HRESULT passed back in result
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Platforms
Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information
.NET Compact Framework
Supported in: 3.5, 2.0