Talk:DirectX:DirectDraw:Tutorials:VBNET:DX9:Basics

From GPWiki

Files:GUITutorial_warn.gif The Game Programming Wiki has moved! Files:GUITutorial_warn.gif

The wiki is now hosted by GameDev.NET at wiki.gamedev.net. All gpwiki.org content has been moved to the new server.

However, the GPWiki forums are still active! Come say hello.

"SetCooperativeLevel" is not working. Are there any other alternatives? - Max

SetCooperativeLevel is nessecary. If you have correctly typed the code (and typos do happen to the best of us), SetCooperativeLevel may be failing because your computer is unable to create a fullscreen device. This seems highly unusual to me, but it is the first thought that popped into my mind. What kind of a graphics card do you have?

It may be a different problem. You didn't give enough information for me to be sure of anything, so if you can give me more details, that might help. Here are some things to double check:

Did you reference both Microsoft.DirectX and Microsoft.DirectX.DirectDraw? Do you understand how to do this?

Did you remember to add both imports statements to the very top of your code?

Are any of the lines underlined in blue? (this only if you are using Microsoft Visual Studio.NET)

If we can't get it working even after you give more details, maybe I could upload my source code for you to test on your machine.

I hope this helps! --Lachlan87 14:32, 3 Apr 2005 (EDT)

About the Cooperative error

I have the same problem. Gives me a line saying "value does not fall into accepted range". Im sure this is referring to the "me" statement. I messed around with both values and still got the same error. -Viper54K

ColorKey

I've looked in a number of different place about this, and it seems that the only colours that work in ColorKeys are black or white. Anyone got any more info on that?

I'm no DX expert, but that doesn't seem right... I'd ask in the forums. Your question would get much more exposure there.--Snoolas 15:00, 5 Sep 2005 (EDT)
Green works fine for me. . . I think your sources were mistaken. Black and white are the most common colours, but you can use whatever. --Lachlan87 20:36, 5 Sep 2005 (EDT)

CooperativeLevelFlags.FullscreenExclusive doesnt work :(

Ok I have tried several bits of code i downloaded and copying and pasting whats written here, but i cannot get it to work, just get the following error:

An unhandled exception of type 'System.ArgumentException' occurred in microsoft.directx.directdraw.dll

Additional information: Value does not fall within the expected range.


"GraphicsCard.SetCooperativeLevel(Me, CooperativeLevelFlags.FullscreenExclusive)"

It seems to me this USED to work, i used this way in VB6 with DX7 and DX8 but may be DX9C wont allow this anymore, theres messages in the help text saying do not use that method and use the new DX9 way. so what is this new way?


OK, I went and figured out how to duplicate the problems people are having, and I have the solution. As I suspected, the problem is that you are mismatching VB.NET versions with Managed DirectX Versions. If you are using VB.Net 2002, you must import Microsoft.DirectX.dll and Microsoft.DirectX.DirectDraw.dll from the folder "C:\WINDOWS\Microsoft.NET\Managed DirectX\v9.00.0900", or "C:\WINDOWS\Microsoft.NET\Managed DirectX\v9.00.1126". All other versions are too recent for VB.NET 2002 (so don't use v9.03.91, because you won't get anywhere!). If you have 2003, any of them will work.
You need to keep this in mind whenever you work with VB.NET 2002 and DirectX. Many of the tutorials online are written in 2003, including all of mine. If this does not resolve your problems, by all means post here or on the forums again.
Also, does anyone think I should add a note about how 2002 and 2003 use different versions at the bottom the article? --Lachlan87 12:46, 1 December 2005 (EST)