Post

 Resources 

Console

Comments



Return to tutorial


7/29/2005 | Posted by: Lachlan87

I can't really guess from what you have written so far. If you could post on the forums, maybe some of the other's here could help us work this out. Good luck!


7/29/2005 | Posted by: Ronald Peterson

I get the following error when I run the program:
"An unhandled exception of type 'Microsoft.DirectX.DirectDraw.InvalidRectangleException' occurred in microsoft.directx.directdraw.dll

Additional information: Error in the application."

I'm using the Directx9 sdk, and this is the statement that it barfs on:
"frm.backbuffer.DrawFast(0, 0, frm.sprite, DrawFastFlags.DoNotWait Or DrawFastFlags.SourceColorKey) 'Draw the sprite"

Do you have any ideas?


7/18/2006 | Posted by: Dmitry Portnoy

I got the following error on:
sprite = New Surface("..dxtest.bmp", New SurfaceDescription, GraphicsCard)

Value does not fall within the expected range.

I'm using VB.NET 2005. I hope someone can help me




6/8/2006 | Posted by: Michael_P2234

Now, how would you add action to a sprite?


6/8/2006 | Posted by: Michael_P2234

< ---- NOTE: VB 2005 Users ---- >
How to get

Shared Sub Main()

as your startup object with Visual Studio 2005.

1) Under the properties of your application >>
UNcheck "Enable Application Framework"

You can now select Sub Main() as your startup object.


6/6/2006 | Posted by: rderkis

I love this! Its easy to understand! Perhaps I could ask a question? I have set your code up to run on form2 after pressing a button. Trouble is if I press the button again (after hitting esc. from directdraw screen) I get the error "WindowsAlreadySetException", when seting coopertive mode. I would like to (dispose?, close?, exit?) of the direct x altogather so I could just hit the button again. Is there a way to do that?



6/21/2006 | Posted by: Max Enyap

I just can’t get the colorkey to work properly.
If I run the program with 16bpp:
GraphicsCard.SetDisplayMode(800, 600, 16, 0, False)
it works fine (blacks are not drawn).

If it try it in 32bpp
GraphicsCard.SetDisplayMode(800, 600, 32, 0, False)
It still works but the colorkey doesn’t (blacks are drawn).

Any ideas?



6/16/2006 | Posted by: und3rd06

sory for spam I had to repost to say that this fix was intended for Dmitry Portnoy

add this at the the begging of your class. I had the same problem as you and this fixed it....

Imports System
Imports System.Windows.Forms
Imports System.Drawing
Imports Microsoft.DirectX
Imports Microsoft.DirectX.DirectDraw


6/16/2006 | Posted by: und3rd06

add this athe the begging of your class. I had the same problem as you and this fixed it....

Imports System
Imports System.Windows.Forms
Imports System.Drawing
Imports Microsoft.DirectX
Imports Microsoft.DirectX.DirectDraw


4/5/2005 | Posted by: Lachlan87

Thanks for you comments, John! Could you be more specific as to what your problems are? For example, are you able to reference the dll's? Or are you being given an error when testing?


4/5/2005 | Posted by: John

I find this very helpful,but still i am having a problem with the microsoft.directx.dll and the other one...but still you made me very inrested with this certain topic!!!


4/21/2005 | Posted by: Lachlan87

If you are using any version of VB.NET, you should be OK. However, if you are using VB.NET 2002, as I am, the Dll's won't show up in the Add Reference Dialog. You can get around this, though. On the Add Reference Dialog window, there should be a "Browse" button. If you browse to C:WINDOWSMicrosoft.NETManaged DirectX you should find folders that include the DirectX dll's. If you are using VB.NET 2002, I think the earliest version will work best. I'm not sure if you can get the most recent one's to work at all.

If you can't find the Managed DirectX folder, or you are using VB.NET 2003 or better, you probably don't have Managed DirectX 9 installed. It is certainly possible to have DirectX 9 and not have Managed DirectX. You can download Managed DirectX from Microsoft's MSDN site.

I hope this is helpful. If it isn't, feel free to write again and let us know! I'm glad to help.

Lachlan


4/21/2005 | Posted by: Jimme

I am unable to reference the dll files, they simply don't appear anywhere under the add reference menu. Am I using the wrong version of VB?


3/14/2005 | Posted by: HajoVonta

This is the tutorial I've been searching for a time. I found a little bug here, however. In the RestoreSurfaces method, the "device" obviously should be "GraphicsCard". Keep up the good work!


3/14/2005 | Posted by: Lachlan87

Thanks for pointing that out, HajoVonta! It's fixed now. Please let me know if you find any other mistakes.


2/20/2006 | Posted by: m1423

Earthlink users: Do not attept to use this program or any full-screen directx applications while your Task Panel is active or else your program will auto-minimize and do other things out of the ordinary. This occured on Windows XP. Hope this solves some problems.


12/10/2005 | Posted by: David Graham

Lachlan, your AWESOME! I finally found a good example of how to page flip, I've been looking for one for a long time, and I actually understand your tutorial/code, typed in for myself and ran it and it worked perfectely.(except there is one error, it took me a sec to figure out: the "device" should be "graphicscard" for both loading of the images, you have one with device and one with graphicscard)

Thx buddy


11/29/2005 | Posted by: Dexxta

If only you had added in switching to windowed mode I would have everything I have looked for on this topic. Thanks for a great article none the less. Wonderful Job.


1/25/2005 | Posted by: Eric Coleman

I think this is a great tutorial. Being able to use Alt+Tab is very important with games, or at least having the ability to not crash if a window (such as an instant message) pops up in the background.


1/22/2006 | Posted by: Lachlan87

You are correct that it expects System.Windows.Forms.Control, but using Me does work on my computer, and in the context that I used it. Are you using the code in my tutorial exactly, or are you using it in a project of your own? I am trying to think of what else might cause it to error out on that line.


1/21/2006 | Posted by: Dmitry Portnoy

I get an error on this line graphicsCard.SetCooperativeLevel(Me, CooperativeLevelFlags.FullscreenExclusive)

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

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

I think that Me is of type System.Windows.Forms.Form, but it wants System.Windows.Forms.Control

Do you know anything I can do to fix this? I'm using VB.NET 2003





Name
Email (optional)
Comment





Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.
There have been 28 visitors within the last 20 minutes
RSS News Feed