Private Sub Command1_Click()
'On Error GoTo err:
If Winsock2.State <> wskclosed Then
Winsock2.Close
End If
With Winsock2
.LocalPort = 7777
.RemotePort = 7777
.RemoteHost = usernow.ip
.Bind
End With
If Text1.Text = "" Then
MsgBox "发送信息不能为空!"
Else
'与全局的接口usernow
Winsock2.SendData Text1.Text
Debug.Print Text1.Text & " was send"
Text1.Text = ""
End If
Exit Sub
err:
MsgBox ("can not connect to " + usernow.name)
End SubPrivate Sub Command2_Click()
If Me.Height < 4000 Then
Me.Height = 1.7 * Me.Height
Else
Me.Height = Me.Height / 1.7
End If
End SubPrivate Sub Command3_Click()
Unload Me
End SubPrivate Sub Form_Load()
Debug.Print usernow.name
Text2.Text = ""
'VScroll1.Visible = False
Skin1.ApplySkin Me.hWnd
End SubPrivate Sub VScroll1_Change()
Text2.Top = -VScroll1.Value
End SubPrivate Sub Form_LostFocus()
Winsock2.Close
End SubPrivate Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
'On Error GoTo err:
Debug.Print "datacomes"
Winsock2.RemoteHost = ""
Dim tmp As String
Winsock2.GetData tmp
tmp = " message from" & usernow.name & "(" & Winsock2.RemoteHostIP & ";" & Winsock2.RemotePort & ")at:" + CStr(Time) + vbCrLf + tmp
Text2.Text = Text2.Text + vbCrLf + tmp
Debug.Print Text2.Text
Debug.Print Text2.Height & "and" & Picture1.Height
Exit Sub
'VScroll1.Visible = True
err:
MsgBox ("can not connect to " + usernow.name)End SubPrivate Sub Winsock2_SendComplete()
Winsock2.Close
End Sub