Share via


Device.CheckCooperativeLevel() Method (Microsoft.DirectX.Direct3D)

Reports the current cooperative-level status of the Microsoft Direct3D device for a windowed or full-screen application.

Definition

Visual Basic Public Function CheckCooperativeLevel() As Boolean
C# public bool CheckCooperativeLevel();
C++ public:
bool CheckCooperativeLevel();
JScript public function CheckCooperativeLevel() : boolean;

Return Value

System.Boolean
Current cooperative-level status of the device for a windowed or full-screen application. A return value of true indicates that the device is operational and that the calling application can continue; a value of false indicates that the device is lost or needs to be reset.

Remarks

If the device is lost but cannot be restored at the current time, Device.CheckCooperativeLevel returns the DeviceLost result code in the param_Int32R_result parameter. This is the case, for example, when a full-screen device loses focus. If an application detects a lost device, it should pause and periodically call Device.CheckCooperativeLevel until it receives a return value of DeviceNotReset. The application can then attempt to reset the device by calling Device.Reset and, if this succeeds, restore the necessary resources and resume normal operation. Note that Device.Present throws a DeviceLostException if the device is lost or not reset.

A call to CheckCooperativeLevel fails if made on a different thread than the one used to create the device being reset.

See Also