Mouse Events
Mouse Events
Mouse Events
Mouse Events
Mouse Events
Mouse Events Mouse Events Mouse Events Mouse Events Mouse Events Mouse Events Mouse Events Mouse Events
Mouse Events Mouse Events
Mouse Events
Go Back  Xtreme Visual Basic Talk > > > Mouse Events


Reply
 
Thread Tools Display Modes
  #41  
Old 05-23-2004, 07:27 AM
Iceplug's Avatar
IceplugMouse Events Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default


Well, he creates the peer object like this:

Dim conn As Peer

conn = New Peer(flags) 'create a new peer object
That sets the peer object to a new instance.

It's in the fourth block of code (the big one at the top).
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #42  
Old 05-23-2004, 08:08 PM
Sippy Cup's Avatar
Sippy Cup Sippy Cup is offline
Freshman
 
Join Date: Mar 2004
Location: TN, USA
Posts: 39
Default

Yep. That's exactly how I did it, and for some reason, it's telling me my Peer object is not set to an instance of an object. It gives the error in the host method, on the line "_conn.Host(desc, _add)" which, as he explains, is supposed to actually begin hosting the session. I thought maybe it was talking about desc or _add, so I made sure I had used New with them too, which I have. The actual error says, "Object referrence not set to an instance of an object." I also tried to use New inside the Host method just to see what would happen, but it gave me the same error.

Last edited by Sippy Cup; 05-23-2004 at 08:17 PM.
Reply With Quote
  #43  
Old 05-23-2004, 08:28 PM
Iceplug's Avatar
IceplugMouse Events Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Hmm... maybe the peer is being accessed before you realize that it is. What code do you have for the Peer declaration / initialization, and then, where do you get the error? (Try showing what code executes from the initialization to the error line.)

Are you disposing the Peer or setting it to nothing? That might cause problems as well.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #44  
Old 05-24-2004, 11:18 AM
Sippy Cup's Avatar
Sippy Cup Sippy Cup is offline
Freshman
 
Join Date: Mar 2004
Location: TN, USA
Posts: 39
Default

Code:
Option Strict On
Imports Microsoft.DirectX.DirectPlay
Imports Microsoft.DirectX

Public Class DirectPlayPeer
    Private m_Peer As Peer
    Private m_LocalAddy As Address
    Private m_Connected As Boolean = False
    Public m_frmSabacc As Form

    Public Sub New(ByVal flags As InitializeFlags)
        m_Peer = New Peer(flags)

        AddHandler m_Peer.FindHostResponse, AddressOf FindHost
        AddHandler m_Peer.ConnectComplete, AddressOf ConnectComplete

        If TCPIPAvailable() = False Then
            MessageBox.Show("TCP/IP is not available.", "Service Error", _
            MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
        m_LocalAddy = New Address()
        m_LocalAddy.ServiceProvider = Address.ServiceProviderTcpIp
    End Sub

    Private Function TCPIPAvailable() As Boolean
        Dim serviceinfo As ServiceProviderInformation() = _
        m_Peer.GetServiceProviders(False)
        Dim s As ServiceProviderInformation

        For Each s In serviceinfo
            If s.Guid.Equals(Address.ServiceProviderTcpIp) Then
                Return True
            End If
        Next
        Return False
    End Function

    Public Sub Host()
        Dim desc As ApplicationDescription = New ApplicationDescription()

        desc.SessionName = "Session"
        desc.GuidApplication = New Guid("282824AD-AB35-48F4-ABC3-DE481A69C1A7")
        desc.MaxPlayers = 6
        m_Peer.Host(desc, m_LocalAddy)
There ya go. That last line is it. That's straight out of that guy's tutorial, with the names changed. As you can see, I have Peer declared and initialized where he does. When I try to use it in the Host method, however, it says I haven't set it to an instance. Something seems strange about that TCPIPAvailable function. For one thing, I don't know about that serviceinfo array being without brackets, but I don't get a syntax error from it. GetServiceProviders says it enumerates all the registered service providers, so I guess, since multiple entries are being put into the array, it doesn't generate a syntax error. Still weird, though. Also, won't that function return false no matter what? He didn't use an Else in his If Then statement, he put the Return False outside of the If and the For Each.

I also don't like this:

Code:
        If TCPIPAvailable() = False Then
            MessageBox.Show("TCP/IP is not available.", "Service Error", _
            MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
        m_LocalAddy = New Address()
        m_LocalAddy.ServiceProvider = Address.ServiceProviderTcpIp
Once again, outside of the If. What happens when TCPIPAvailable is False and the user clicks OK on the MessageBox? The program will still try to stick an address into the address variable, and will try to get the service provider info from the address. I think it should say, "If TCPIPAvailable = True Then set the address, get the ServiceProvider Else display the messagebox." And I think that TCPIPAvailable function should say have "Else Return False, End If, Next" instead of the way it is arranged now. What do you think?
Reply With Quote
  #45  
Old 05-24-2004, 02:50 PM
Iceplug's Avatar
IceplugMouse Events Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Well, I have to say that I don't know how DirectPlay works... how/where you are creating the new DirectPlayPeer and calling the Host method. I thought that you were going to ask him on his forum?
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #46  
Old 05-25-2004, 11:02 AM
Sippy Cup's Avatar
Sippy Cup Sippy Cup is offline
Freshman
 
Join Date: Mar 2004
Location: TN, USA
Posts: 39
Default

I registered on his forum, but for some reason, I can't post. Says I'm logged in and all, but I can't reply or start a new thread. Oh well.
Reply With Quote
  #47  
Old 05-26-2004, 05:54 AM
Iceplug's Avatar
IceplugMouse Events Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

You probably need to e-mail/pm him about that.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #48  
Old 06-02-2004, 12:25 PM
Sippy Cup's Avatar
Sippy Cup Sippy Cup is offline
Freshman
 
Join Date: Mar 2004
Location: TN, USA
Posts: 39
Default

New development.

I copied the code out of the DirectX tutorial *.vb files and pasted it into my own project in Visual Studio. It worked, the form was created and everything, all I had to do was create the Host Class, add the DirectX references, and define the startup object. So I debugged it, and guess what.

"Object not set to an instance of an object"

This is beyond weird. I'm going to use DirectX's built in debugger to find out what is going on.. I hope it WILL find out what is going on, because that's the same error I got on my own DirectX code. In other news, I have failed entirely to be able to update my Visual Studio .NET software so I can just open DirectX's tutorials instead of copying their code from notepad. The software just won't update. I guess I'm just going to have to get a newer version from the college library or something.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
simulating mouse click events yss API 3 11-27-2003 07:17 AM
Sendmessage (Mouse events) coordinate problems Hena API 3 11-19-2003 05:42 AM
Having trouble understanding SendInput for mouse events. MrMcGoo API 4 02-12-2003 11:47 PM
Ignore Certain Mouse Events in Usercontrol Infector General 2 01-16-2003 05:33 AM
mouse down / mouse up xmen64 Interface and Graphics 5 10-09-2002 10:36 AM

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
Mouse Events
Mouse Events
Mouse Events Mouse Events
Mouse Events
Mouse Events
Mouse Events Mouse Events Mouse Events Mouse Events Mouse Events Mouse Events Mouse Events
Mouse Events
Mouse Events
 
Mouse Events
Mouse Events
 
-->