Hi all,
I'm having trouble with a prog i've written.
It all works fine until another application obscures the directX target area (its on a picture box). When this happens the mouse moves really slowly.
I've added a check to stop calling render if the screen is minimized, which works fine, now I just need a check to see if the directX picutrebox is still visible.
So far I have the following code in render:
'My rendering operations
'End the scene
Me.device.EndScene()
Try
Me.device.Present()
Catch ex As Microsoft.DirectX.Direct3D.DeviceLostException
RecoverFromLost()
End Try
and the recoverFromLost function starts with
Dim Code As Int16
While (True)
Me.device.CheckCooperativeLevel(Code)
If Code = Microsoft.DirectX.Direct3D.ResultCode.DeviceNotReset Then
Exit While
End If
System.Threading.Thread.Sleep(1000)
End While
'code to reset the device
However this only gets called if ctrl+alt+delete is pressed and always throws the exception
An unhandled exception of type 'System.OverflowException' occurred in 1.exe
Additional information: Arithmetic operation resulted in an overflow.
This points to the CheckCooperativeLevel call.
So, does anyone know what calls I need to be making to see if the device should stop rendering (i.e. the draw surface is obscured) and why the checkcooperativeLevel function is overflowing.
Many thanks
DRB2k2