Device.CheckCooperativeLevel(Int32) 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( _
ByRef result As Integer _
) As BooleanC# public bool CheckCooperativeLevel(
out int result
);C++ public:
bool CheckCooperativeLevel(
[Out] int% result
);JScript public function CheckCooperativeLevel(
result : int
) : boolean;
Parameters
result System.Int32
[in, out] Current cooperative-level status of the device for a windowed or full-screen application, reported using a ResultCode value. A Success result indicates that the device is operational and that the calling application can continue. A DeviceLost result indicates that the device is lost but cannot be reset at this time; therefore, rendering is not possible. A DeviceNotReset result indicates that the device is lost but can be reset at this time.
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