   SlimDX problem with full screen at lower resolution
  I'm porting my apps from MDX to SlimDX, and I've got resizing and toggling to full screen working nicely, but only if I set the back buffer resolution to the monitor's max resolution when going to full screen.  If I try to operate in full screen mode at a lower resolution to keep the frame-rate up, I run into problems.  When I try that I can:1. Toggle back and forth between windowed and full screen all day long, though toggling is extremely slow, or2. resize the windowed app all day long, or 3. toggle back and forth between windowed and full screen, then resize the window.But, once I resize the windowed app, the next time I try to toggle to full screen, I get that unhandled exception on device.Reset().To isolate this I've stripped the app down so it's doing nothing.  And I mean nothing.  I'm not rendering anything.  I don't create any DirectX resources.  The only thing I do is clear the back buffer then do an empty render and Present().I've set up WindowPlacement structures for both the windowed mode and the full screen mode and I initialize the full screen placement structure to:fullscreenPlacement.length = WindowPlacement.Length;fullscreenPlacement.flags = 0;fullscreenPlacement.showCmd = SW_SHOWNORMAL;fullscreenPlacement.ptMaxPosition = new Point(-1, -1);fullscreenPlacement.ptMinPosition = new Point(-1, -1);fullscreenPlacement.rcNormalPosition.left = 0;fullscreenPlacement.rcNormalPosition.top = 0;I hook the Window_Resize event where I do the following:private void ResetDevice(){    OnDeviceLost();    Result r = device.Reset(presentParams);    //createParams = device.CreationParameters;    OnDeviceReset();}private void Window_Resize(object sender, System.EventArgs e){    presentParams.BackBufferWidth = Window.ClientRectangle.Width;    presentParams.BackBufferHeight = Window.ClientRectangle.Height;    ResetDevice();}Right now the OnDeviceLost and OnDeviceReset methods are empty except for resetting the camera's aspect ration to the new value.  And the ToggleFullScreen method looks like this:private void ToggleFullScreen(){    if (presentParams.Windowed)    {   //Going FullScreen so save the windowed style and placement   windowedstyle = GetWindowLong(Window.Handle, GWL_style);   windowedPlacement.length = WindowPlacement.Length;   GetWindowPlacement(Window.Handle, ref windowedPlacement);   windowedWidth = presentParams.BackBufferWidth;   windowedHeight = presentParams.BackBufferHeight;   //Set the BackBuffer W & H to the screen W & H   int screenWidth = System.Windows.Forms.SystemInformation.PrimaryMonitorSize.Width;   int screenHeight = System.Windows.Forms.SystemInformation.PrimaryMonitorSize.Height;   presentParams.BackBufferWidth = screenWidth;   presentParams.BackBufferHeight = screenHeight;    }    else    {   presentParams.BackBufferWidth = windowedWidth;   presentParams.BackBufferHeight = windowedHeight;    }    presentParams.Windowed = !presentParams.Windowed;    ResetDevice();    if (presentParams.Windowed)    {   //Going windowed so restore the windowed style and placement   SetWindowLong(Window.Handle, GWL_style, (uint)windowedstyle);   SetWindowPlacement(Window.Handle, ref windowedPlacement);   Window.TopMost = windowedTopMost;    }    else    {   //Going fullscreen so set a style and placement compatable with fullscreen   int screenWidth = System.Windows.Forms.SystemInformation.PrimaryMonitorSize.Width;   int screenHeight = System.Windows.Forms.SystemInformation.PrimaryMonitorSize.Height;   SetWindowLong(Window.Handle, GWL_style, (uint)(WS_POPUP | WS_SYSMENU));   //now set the remaining parameters in fullscreenPlacement   fullscreenPlacement.rcNormalPosition.right = presentParams.BackBufferWidth;   fullscreenPlacement.rcNormalPosition.bottom = presentParams.BackBufferHeight;   SetWindowPlacement(Window.Handle, ref fullscreenPlacement);    }}Everything works fine in the above code until I comment out the four lines that set the BackBuffer W & H to the screen W & H.  Then I run into trouble.  Anyone got any ideas?   
  What kind of problem, exactly? What are the exception details from Reset? Are the debug runtimes putting out any useful information?   ;  In the ResetDevice method on the call to device.Reset it's throwing the unhandled exception D3DERR_INVALIDCALL (-2005530516) with no useful information.  I've got the Degug Runtime turned on, but I'm using C# 2008 Express and I'm told that it doesn't provide much useful stuff.Any suggestions.   ;  Download DebugView. It will let you see the debug output from D3D without having to have the full version of VS installed.   ;  Actually I've the same problem, if i set the backbuffert width/height to e.g 1200x800 I get an exception, and in the outputwindow there is the following output:Direct3D9: (ERROR) :Display mode is unsupportedDirect3D9: (ERROR) :Display mode is unsupportedDirect3D9: (ERROR) :Display mode is unsupportedDirect3D9: (ERROR) :Display mode is unsupportedDirect3D9: (ERROR) :Unable to set the new mode. CreateDevice/Reset FailsDirect3D9: (ERROR) :ResetEx failed and ResetEx/TestCooperativeLevel/Release are the only legal APIs to be called subsequentlyD3D9 Helper: IDirect3DDevice9::Reset failed: D3DERR_INVALIDCALLA first chance exception of type 'SlimDX.Direct3D9.Direct3D9Exception' occurred in SlimDX.dllAn unhandled exception of type 'SlimDX.Direct3D9.Direct3D9Exception' occurred in SlimDX.dllAdditional information: D3DERR_INVALIDCALL: Invalid call (-2005530516)But some sizes work in fullscreen, for example: 800x600, 1920x1200regards,Kevin   ;  My screen native resolution is 1280x1024.  No problems when I go full screen at native resolution, but going full screen at 1024x768 or 800x600 throws the exception.I'll download DebugView and give it a try.   ;  Sorry to dump so much info, but here is the DebugView output:This was generated by startup:[5680] Direct3D9: :====> ENTER: DLLMAIN(0489e6e0): Process Attach: 00001630, tid=00001720[5680] [5680] Direct3D9: :====> EXIT: DLLMAIN(0489e6e0): Process Attach: 00001630[5680] [5680] Direct3D9: (INFO) :Direct3D9 Debug Runtime selected.[5680] [5680] Direct3D9: (INFO) :======================= Hal HWVP device selected [5680] [5680] Direct3D9: (INFO) :HalDevice Driver style 9 [5680] [5680] Direct3D9: :DoneExclusiveMode[5680] [5680] D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.58456e+029f.  This is ok. This was generated when I toggled to fullscreen and back:[5680] Direct3D9: :Subclassing window 00120552[5680] [5680] Direct3D9: :StartExclusiveMode[5680] [5680] Direct3D9: :WM_DISPLAYCHANGE: 800x600x32[5680] [5680] D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.58456e+029f.  This is ok. [5680] Direct3D9: :Window 00030040 is on top of us!![5680] [5680] Direct3D9: :Window 00030040 is on top of us!![5680] [5680] Direct3D9: :Window 00030040 is on top of us!![5680] [5680] Direct3D9: :Window 00030040 is on top of us!![5680] [5680] Direct3D9: :Window 00030040 is on top of us!![5680] [5680] Direct3D9: :Window 00030040 is on top of us!![5680] [5680] Direct3D9: :Window 00030040 is on top of us!![5680] [5680] Direct3D9: :Window 00030040 is on top of us!![5680] [5680] Direct3D9: :StartExclusiveMode[5680] [5680] D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.58456e+029f.  This is ok. [5680] Direct3D9: :DoneExclusiveMode[5680] [5680] Direct3D9: :INACTIVE: 00001630: Restoring original mode (1280x1024x22x75) at adapter index 0[5680] [5680] Direct3D9: :WM_DISPLAYCHANGE: 1280x1024x32[5680] [5680] Direct3D9: :Unsubclassing window 00120552[5680] [5680] D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.58456e+029f.  This is ok. [5680] Direct3D9: :DoneExclusiveMode[5680] [5680] D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.58456e+029f.  This is ok. This was generated when I resized the windowed app:[5680] Direct3D9: :DoneExclusiveMode[5680] [5680] D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.58456e+029f.  This is ok. [5680] Direct3D9: :DoneExclusiveMode[5680] [5680] D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.58456e+029f.  This is ok. [5680] Direct3D9: :DoneExclusiveMode[5680] [5680] D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.58456e+029f.  This is ok. [5680] Direct3D9: :DoneExclusiveMode[5680] [5680] D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.58456e+029f.  This is ok. [5680] Direct3D9: :DoneExclusiveMode[5680] [5680] D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.58456e+029f.  This is ok. [5680] Direct3D9: :DoneExclusiveMode[5680] [5680] D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.58456e+029f.  This is ok. [5680] Direct3D9: :DoneExclusiveMode[5680] [5680] D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.58456e+029f.  This is ok. This was generated when I again tried to toggle to fullscreen:[5680] Direct3D9: :Subclassing window 00120552[5680] [5680] Direct3D9: :StartExclusiveMode[5680] [5680] Direct3D9: (ERROR) :The specified mode is unsupported. CreateDevice/Reset Fails[5680] [5680] Direct3D9: (ERROR) :Unable to set the new mode. CreateDevice/Reset Fails[5680] [5680] Direct3D9: (ERROR) :Reset failed and Reset/TestCooperativeLevel/Release are the only legal APIs to be called subsequently[5680] [5680] Direct3D9: :DoneExclusiveMode[5680] [5680] Direct3D9: :INACTIVE: 00001630: Restoring original mode (1280x1024x22x75) at adapter index 0[5680] [5680] Direct3D9: :Unsubclassing window 00120552[5680] [5680] D3D9 Helper: IDirect3DDevice9::Reset failed: D3DERR_INVALIDCALL At this point the app threw the exception and I killed it.   ;  What is the full display mode (including bitdepth and refresh rate) that you're attempting to set, and did you check to see if the adapter supports that. The error message you are getting is suggesting that you're not properly setting one of the parameters, or that you're attempting to set a format that is not supported by the adapter.   ;  Washu:I don't think that's the problem.  My Adapter is an NVidia GeForce 8800 GT with 512KB of memory.  All I'm trying to do is to set it to 1024x768 or 800x600 at full screen, X8R8G8B8 format, which I know it supports since I can set my desktop to that, and I've done plenty of gaming at those resolutions.No, I think it's something a bit more hinky.Jim   ;  You know, I had a similar issue about a month ago too. Honestly it did eventually work but I really never did figure out why.After giving up on full screen for a while I decided to let off some steam by working on enumerator for the possible valid settings. It ended up defaulting to the best enumerated match of the desired setting rather than simply hard coding something that was 'supposed' to work. Then it stopped crashing. I never really had the time to go back and figure out why it worked though. More than likely it was probably some other setting I just forgot about though and the automated enumeration did it for me.   