this code workes fine:
[code]
...
PresentParameters d3dpp = new PresentParameters();
d3dpp.Windowed = true;
d3dpp.EnableAutoDepthStencil = true;
d3dpp.PresentFlag = PresentFlag.LockableBackBuffer;
d3dpp.AutoDepthStencilFormat = DepthFormat.D16;
d3dpp.SwapEffect = SwapEffect.Discard;
d3dpp.BackBufferCount = 1;
d3dpp.BackBufferWidth = Width;
d3dpp.BackBufferHeight = Height;
d3dpp.BackBufferFormat = Format.X8R8G8B8;
d3dpp.PresentationInterval = PresentInterval.Immediate;
try
{
directDevice = new Device(0, DeviceType.Hardware,
renderWindow, flags, d3dpp);
}
...
[/code]
Applicationcorrect render scene.
But if i set d3dpp.Windowed = false it crahed here:
[code]
try
{
Application.Run(new Form1());
}
catch (DirectXException e)
{
MessageBox.Show(e.Message);
}
[/code]
with the message Error in the application
ErrorString = "D3DERR_INVALIDCALL"
ErrorCode = -2005530516
base:
StackTrace = " at
Microsoft.DirectX.Direct3D.Device.Reset(PresentParameters[]
presentationParameters)\r\n at
Microsoft.DirectX.Direct3D.Device.OnParentResized(Object sender, EventArgs
e)\r\n at System.Windows.Forms.Control.OnResize(EventArgs e)\r\n at
System.Win...
Then i set Form1 WindowState property to Maximized the program start work
correct, but when alt-tab or win key pressed it crashed again with the same
error.
About the only thing I'd suggest to try is turning on the Direct3D 9 Debug
through the DirectX Control Panel.
--
--
-Chuck Walbourn
SDE, XNA Developer Connection
This posting is provided "AS IS" with no warranties, and confers no rights.