drdave Posted November 4, 2003 Posted November 4, 2003 Hi, my name is Dave and i'm new on this forum. I get an error when running this code, it's vb.net and directx9. display = New Microsoft.DirectX.DirectDraw.Device(CreateFlags.Default) display.SetCooperativeLevel(Me.PictureBox1, CooperativeLevelFlags.Exclusive) this is the error that i get: An unhandled exception of type 'System.ArgumentException' occurred in microsoft.directx.directdraw.dll Additional information: Value does not fall within the expected range if some one could help me i would be grateful. best regards /DrDave Quote
*Experts* Nerseus Posted November 4, 2003 *Experts* Posted November 4, 2003 Run the following file: c:\DXSDK\Bin\DXUtils\dbmon.exe Then start your project in Debug mode in Visual Studio. The command window opened by dbmon will display a ton of information, including more detailed error messages. My guess is that you're trying to make a picturebox an exclusive device and it can't be done. You can only use a form when going exclusive (fullscreen). -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
drdave Posted November 4, 2003 Author Posted November 4, 2003 wow, that was a fast replay! thank you :) hmm, is there no way to beable to do a flip to transfer the backbuffer to the front, as it's faster.. ? anyways thank you ones again for your fast replay. Quote
AndreRyan Posted November 6, 2003 Posted November 6, 2003 The error is here: display.SetCooperativeLevel(Me.PictureBox1, CooperativeLevelFlags.Exclusive) It should be: display.SetCooperativeLevel(Me, CooperativeLevelFlags.Exclusive Or CooperativeFlags.FullScreen) Controls on forms cannot be used for fullscreen displays. If you want a Windowed app you'll need to use the Normal flag. The point of using Exclusive is to have a fullscreen app but Microsoft decided to make the flags seperate to increase confusion. In DX9.Net, however, there is a FullscreenExclusive flag I think. In Normal you cannot use Flip, only Blt. It's probably got something to do with being unable to rearrange Video Memory pointers whilst GDI controls the Video Card. Quote .Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.