Microsoft DirectX 8.1 (Visual Basic)

Direct3DDevice8.TestCooperativeLevel

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

object.TestCooperativeLevel() As Long

Parts

object
Object expression that resolves to a Direct3DDevice8 object.

Return Values

If the method succeeds, it returns D3D_OK, indicating that the device is operational and the calling application can continue executing.

Error Codes

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

D3DERR_DEVICELOST
D3DERR_DEVICENOTRESET

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

Remarks

If the device is lost but cannot be restored at the current time, this method returns the D3DERR_DEVICELOST return code. This would be the case, for example, when a full-screen device has lost focus. If an application detects a lost device, it should pause and periodically call TestCooperativeLevel until it receives a return value of D3DERR_DEVICENOTRESET. The application may then attempt to reset the device by calling Direct3DDevice8.Reset and, if this succeeds, restore the necessary resources and resume normal operation. Note that Direct3DDevice8.Present will return D3DERR_DEVICELOST if the device is either "lost" or "not reset".