📄 myoicq_client.frm
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form Form1
Caption = "客户端"
ClientHeight = 4350
ClientLeft = 60
ClientTop = 345
ClientWidth = 4725
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4350
ScaleWidth = 4725
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
Height = 375
Left = 2280
TabIndex = 7
Top = 240
Width = 1935
End
Begin VB.CommandButton Command1
Caption = "连接"
Height = 375
Left = 360
TabIndex = 6
Top = 2760
Width = 975
End
Begin VB.CommandButton command3
Caption = "退出"
Height = 375
Left = 3240
TabIndex = 3
Top = 2760
Width = 975
End
Begin MSWinsockLib.Winsock Winsock1
Left = 2760
Top = 1560
_ExtentX = 741
_ExtentY = 741
_Version = 393216
RemotePort = 1200
End
Begin VB.CommandButton Command2
Caption = "发送"
Enabled = 0 'False
Height = 375
Left = 1800
TabIndex = 2
Top = 2760
Width = 975
End
Begin VB.TextBox Text3
Height = 855
Left = 240
MultiLine = -1 'True
TabIndex = 1
Top = 3360
Width = 4095
End
Begin VB.TextBox Text2
BackColor = &H00C0C0C0&
Height = 1575
Left = 240
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 960
Width = 4095
End
Begin VB.Label Label3
Caption = "服务端IP:"
Height = 255
Left = 1320
TabIndex = 8
Top = 240
Width = 975
End
Begin VB.Label Label2
Caption = "发送信息:"
Height = 255
Left = 360
TabIndex = 5
Top = 3480
Width = 975
End
Begin VB.Label Label1
Caption = "接收到的消息:"
Height = 255
Left = 360
TabIndex = 4
Top = 720
Width = 1335
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Winsock1.Connect Text1.Text, Winsock1.RemotePort
End Sub
Private Sub Command2_Click()
If Trim(Text3.Text) <> "" Then
Winsock1.SendData Text3.Text
Else
MsgBox "没有信息可以传送!"
End If
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Winsock1_Connect()
Command1.Enabled = False
Command2.Enabled = True
MsgBox "连接成功!"
End Sub
Private Sub Winsock1_DataArrival(ByVal bytestotal As Long)
Dim sData As String
Winsock1.GetData sData, vbString
If Text2 <> "" Then
Text2.Text = Text2.Text & vbCrLf & sData
Else
Text2.Text = sData
End If
sData = ""
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Winsock1.State <> sckClosed Then
Winsock1.Close
End If
End
End Sub
Private Sub Winsock1_Close()
Winsock1.Close
Command2.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -