confusing error (directdraw exclusive mode)

drdave

Newcomer
Joined
Nov 3, 2003
Messages
2
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
 
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
 
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.
 
The error is here:
Visual Basic:
display.SetCooperativeLevel(Me.PictureBox1, CooperativeLevelFlags.Exclusive)
It should be:
Visual Basic:
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.
 
Back
Top