   [SlimDX] Window resize
  Hi,I have a problem on a customer’s machine when unlocking after the screen saver has shown.This is a windowed app. The resize event of the form is fired as it unlocks. I reset the device in the resize handler, but occasionally get the following exception:SlimDX.Direct3D9.Direct3D9Exception: D3DERR_DEVICELOST: Device lost (-2005530520)   at SlimDX.Result.Throw[T](Object dataKey, Object dataValue) in d:\promit\documents\slimdx\main\trunk\source\result.cpp:line 118   at SlimDX.Result.Record[T](Int32 hr, Boolean failed, Object dataKey, Object dataValue) in d:\promit\documents\slimdx\main\trunk\source\result.cpp:line 149   at SlimDX.Result.Record[T](Int32 hr, Object dataKey, Object dataValue) in d:\promit\documents\slimdx\main\trunk\source\result.cpp:line 163   at SlimDX.Direct3D9.Device.Reset(PresentParameters presentParameters) in d:\promit\documents\slimdx\main\trunk\source\direct3d9\device.cpp:line 509   at (Object , PresentParameters )   at   .Invoke(Object , PresentParameters )   at SharpCam.Controls.SlimDX.Direct3DControl.ResetDevice() in E:\SharpCam\SharpCam.Controls.SlimDX\Direct3DControl.cs:line 509   at SharpCam.Controls.SlimDX.Direct3DControl.OnResize(EventArgs ) in E:\SharpCam\SharpCam.Controls.SlimDX\Direct3DControl.cs:line 667So if the device is lost while calling Device.Reset then I get the D3DERR_DEVICELOST exception.So I am now thinking that I should mimic my render loop and call Device.TestCooperativeLevel() before I try and reset in the resize event handler, do you agree?All samples that I have looked at, do not go to this extent, I wonder why?ThanksJulian   
  From IDirect3DDevice9::Reset:Quote:If a call to IDirect3DDevice9::Reset fails, the device will be placed in the "lost" state (as indicated by a return value of D3DERR_DEVICELOST from a call to IDirect3DDevice9::TestCooperativeLevel) unless it is already in the "not reset" state (as indicated by a return value of D3DERR_DEVICENOTRESET from a call to IDirect3DDevice9::TestCooperativeLevel). Refer to IDirect3DDevice9::TestCooperativeLevel and Lost Devices (Direct3D 9) for further information concerning the use of IDirect3DDevice9::Reset in the context of lost devices.I also found this thread.It sounds like you should be calling TestCooperativeLevel until it transitions from DeviceLost to DeviceNotReset. (And even then, Reset may fail.) Alternately you can just keep calling Reset until it succeeds -- you might want to use Configuration to disable the exception if you're doing that. TestCooperativeLevel, however, will not generate an exception.   ;  Thanks, I am going to try calling TestCooperativeLevel until it transitions from DeviceLost to DeviceNotReset. Julian   