Form making problem
Form making problem
Form making problem
Form making problem
Form making problem
Form making problem Form making problem Form making problem Form making problem Form making problem Form making problem Form making problem Form making problem
Form making problem Form making problem
Form making problem
Go Back  Xtreme Visual Basic Talk > > > > Form making problem


Reply
 
Thread Tools Display Modes
  #1  
Old 06-17-2007, 03:40 AM
martonx martonx is offline
Centurion
 
Join Date: Jan 2007
Location: Szeged, Hungary
Posts: 129
Default Form making problem


Hello,

I'm new in directx programming, and I would like to make a simple white form with directx, but I get this problem:

http://kepfeltoltes.hu/070617/errorm...toltes.hu_.jpg

The problem occured before, I could trap my code. Please anyone help me.
I use 64bit Windows XP.

And here is my code. It is very simple.

Code:
Imports Microsoft.DirectX
Imports Microsoft.DirectX.DirectDraw

Public Class Form1
    Public dddevice As Device = Nothing
    Public psurface As Surface ' Primary Surface ( user visible)
    Public ssurface As Surface ' Secondary surface ( Back buffer)
    Private clip As Clipper = Nothing

    Public Shared Sub Main()
        Dim GameForm As New form1() ' Making Instance of Form1
        Application.Exit() ' Exiting the Application
    End Sub

    Public Sub New()
        MyBase.New() ' Calling the Base Clas constructor
        'This call is required by the Windows Form Designer.
        InitializeComponent()

        Me.Show()
        dddevice = Nothing
        dddevice = New Device()
        dddevice.SetCooperativeLevel(Me, CooperativeLevelFlags.FullscreenExclusive) 'create a new instance of our Form1 class and pass the form into it

        Init()
        Gameloop()
    End Sub

    Public Sub Init()

        psurface = Nothing
        ssurface = Nothing
        Dim sdesc As New SurfaceDescription()
        clip = New Clipper(dddevice)
        clip.Window = Me
        sdesc.SurfaceCaps.PrimarySurface = True
        sdesc.SurfaceCaps.Flip = True
        sdesc.SurfaceCaps.Complex = True
        sdesc.BackBufferCount = 1
        psurface = New Surface(sdesc, dddevice)
        psurface.Clipper = clip
        sdesc.Clear()
        sdesc.SurfaceCaps.BackBuffer = True
        ssurface = psurface.GetAttachedSurface(sdesc.SurfaceCaps)

    End Sub

    Private Sub Gameloop()
        Do While Me.Created
            If Not Me.Focused Then
                Application.DoEvents()
            Else
                ShowSurface()
                Application.DoEvents()
            End If
        Loop
        ending()
    End Sub

    Public Sub ShowSurface()
        ssurface.ColorFill(Color.White) 'fill the backbuffer ( secondary Surface ) with a color
        psurface.Flip(ssurface, FlipFlags.Wait) 'flip the backbuffer to the front
    End Sub

    Public Sub ending()
        dddevice.Dispose()
        psurface.Dispose()
        ssurface.Dispose()
        clip.Dispose()
    End Sub

    Private Sub form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        If e.KeyCode = Keys.Escape Then
            ending()
            End
        End If
    End Sub

End Class
Reply With Quote
  #2  
Old 11-21-2007, 12:22 PM
fixitchris's Avatar
fixitchris fixitchris is offline
Contributor
 
Join Date: Dec 2004
Posts: 418
Default

get the inner exception of that message. that will help
Reply With Quote
  #3  
Old 12-03-2007, 11:35 AM
Leade's Avatar
Leade Leade is offline
Junior Contributor
 
Join Date: Jul 2005
Location: Wherever i fall over
Posts: 222
Default

Step through the code line at a time then you will see where the exception happens that will pinpoint the problem. and we can fix it for you.
__________________
Fact: The best ideas come when your smashed of your face. So drink beer and be merry!!!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Form making problem
Form making problem
Form making problem Form making problem
Form making problem
Form making problem
Form making problem Form making problem Form making problem Form making problem Form making problem Form making problem Form making problem
Form making problem
Form making problem
 
Form making problem
Form making problem
 
-->