Лабораторная работа: Greating game on visual basic with multiplayer system
Set dxplay = dx7. DirectPlayCreate ("") 'open directplay object
'gets connection types
Set EnumConnect = dxplay. GetDPEnumConnections ("", DPCONNECTION_DIRECTPLAY)
End Function
Private Sub joingame_Click ()
On Error GoTo Joinfailed
If playersname = "" Then
MsgBox "You must enter a Players name", vbOKOnly, "Tic Tac Oops"
Exit Sub
End If
Dim SessionData As DirectPlaySessionData
Set SessionData = EnumSession. GetItem (1)
'Joins open session
Call dxplay. Open (SessionData, DPOPEN_JOIN)
'creats and sends player info
PlayerName = playersname. Text
profilename = PlayerName
playerhandle = "Player (Client)"
MyPlayer = dxplay. CreatePlayer (PlayerName, playerhandle, 0, 0)
Call UpdateWaiting
joingame. Enabled = False
playersname. Enabled = False
MainBoard. mnuchat. Enabled = True
Exit Sub
Joinfailed:
MsgBox "Joining Session Failed", vbOKOnly, "No Session Found"
Exit Sub
End Sub
Public Sub UpdateWaiting ()