Dim Valore As String Private Sub Form_Load() Valore = "O" 'FinePartita (False) End Sub Private Sub Command2_Click() wskTris.SendData ("new_game") Dim i As Integer i = 0 For i = 0 To 8 Command1(i).Enabled = True Command1(i).Caption = "" Next i End Sub Private Sub FinePartita(state As Boolean) Dim i As Integer i = 0 If state = False Then For i = 0 To 8 Command1(i).Enabled = False Next i Else For i = 0 To 8 Command1(i).Enabled = True Next i End If End Sub Private Sub Command3_Click() Unload Me End Sub Private Sub Command1_Click(Index As Integer) If Valore = "O" Then Command1(Index).Caption = "O" Else Command1(Index).Caption = "X" End If wskTris.SendData ("bla bla") Command1(Index).Enabled = False FinePartita (False) If Command1(0).Caption <> "" And Command1(0).Caption = Command1(3).Caption And Command1(0).Caption = Command1(6).Caption Then MsgBox Command1(0).Caption & " Ha Vinto" FinePartita (False) Exit Sub End If If Command1(1).Caption <> "" And Command1(1).Caption = Command1(4).Caption And Command1(1).Caption = Command1(7).Caption Then MsgBox Command1(1).Caption & " Ha Vinto" FinePartita (False) Exit Sub End If If Command1(2).Caption <> "" And Command1(2).Caption = Command1(5).Caption And Command1(2).Caption = Command1(8).Caption Then MsgBox Command1(2).Caption & " Ha Vinto" FinePartita (False) Exit Sub End If If Command1(0).Caption <> "" And Command1(0).Caption = Command1(1).Caption And Command1(0).Caption = Command1(2).Caption Then MsgBox Command1(0).Caption & " Ha Vinto" FinePartita (False) Exit Sub End If If Command1(3).Caption <> "" And Command1(0).Caption = Command1(4).Caption And Command1(3).Caption = Command1(5).Caption Then MsgBox Command1(3).Caption & " Ha Vinto" FinePartita (False) Exit Sub End If If Command1(6).Caption <> "" And Command1(6).Caption = Command1(7).Caption And Command1(6).Caption = Command1(8).Caption Then MsgBox Command1(6).Caption & " Ha Vinto" FinePartita (False) Exit Sub End If If Command1(0).Caption <> "" And Command1(0).Caption = Command1(4).Caption And Command1(0).Caption = Command1(8).Caption Then MsgBox Command1(0).Caption & " Ha Vinto" FinePartita (False) Exit Sub End If If Command1(2).Caption <> "" And Command1(2).Caption = Command1(4).Caption And Command1(2).Caption = Command1(6).Caption Then MsgBox Command1(2).Caption & " Ha Vinto" FinePartita (False) Exit Sub End If End Sub Private Sub wskTris_ConnectionRequest(ByVal requestID As Long) 'funzione che gestisce la conessione wskTris.Close wskTris.Accept requestID MsgBox "Conessione avvenuta" End Sub Private Sub cmdConnect_Click() wskTris.Connect txtHost.Text, txtPort.Text 'richiesta di conessione End Sub Private Sub Option1_Click() wskTris.LocalPort = 4000 wskTris.Listen Valore = "X" 'server gioca con X cmdConnect.Enabled = False End Sub Private Sub wskTris_DataArrival(ByVal bytesTotal As Long) Dim DataRecieved As String Dim Index As Double wskTris.GetData DataRecivied, vbString, bytesTotal Text1.Text = DataRecieved FinePartita (True) End Sub