Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Blight

VB.NET and DirectPlay8 samples

This topic is 6257 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I''ve been playing with VB.NET Beta2 SP2 and tried to create my own lobby server using DirectPlay based on the vb_simpleserver sample in the DirectX8 SDK. I am using the vb_simpleclient sample compiled with VB6SP5 to connect and test my server app. When a player connects to my server, I want to add their info to a collection via GetClientInfo - and that''s about it for now Everything seems to be going well, client shows my server program in its list of Enum''d hosts, but when I connect to my server the server throws the following error: "An unhandled exception of type ''System.InvalidCastException'' occurred in Chatterbox.exe Additional information: QueryInterface for interface DxVBLibA.DirectPlay8Server failed." This occurs in the CreatePlayer event (as in DxVBLibA.DirectPlay8Event.CreatePlayer) when I try and perform a GetClientInfo. My code for this event is as follows: --------------------------------------------- Public Sub CreatePlayer(ByVal lPlayerID As Integer, ByRef fRejectMsg As Boolean) Implements DxVBLibA.DirectPlay8Event.CreatePlayer Dim dpPlayerInfo As DxVBLibA.DPN_PLAYER_INFO ''Check if server is started yet (stops getting CreatePlayer from server when starting) If Not gfStarted Then Exit Sub End If ''Log event to listbox lstPlayers.Items.Add("Player attempting connection...") Try ''Get the player info ''ERROR OCCURS HERE!!! dpPlayerInfo = dps.GetClientInfo(lPlayerID) ''Add this player info struct to collection If dpPlayerInfo.name <> "" Then gcolPlayers.Add(dpPlayerInfo, dpPlayerInfo.name) lstPlayers.Items.Add(dpPlayerInfo.name & " connected.") End If Catch ''Default catch-all If Err.Number Then lstPlayers.Items.Add("Error: " & Err.Number & "," & Err.Description) Exit Sub End If End Try End Sub --------------------------------------------- Any ideas? Anyone tried converting the DirectPlay samples for use in VB.NET? I know I could use WinSockets in VB.NET, but I wanted to learn about DirectPlay, and I have heard somewhere that DirectX9 will probably (probably being the operative word here include .NET-enabling. The error itself sort of looks like a problem with the DirectX8 for Visual Basic library and the way VB.NET is calling it... Thanks! Blighty

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!