📄 form1.frm
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "richtx32.ocx"
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "ComX 服务器"
ClientHeight = 5985
ClientLeft = 45
ClientTop = 615
ClientWidth = 6615
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 5985
ScaleWidth = 6615
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command9
Caption = "删除内容"
Height = 285
Left = 4680
TabIndex = 24
Top = 5640
Width = 1695
End
Begin VB.CommandButton Command8
Caption = "删除错误报告"
Height = 285
Left = 4680
TabIndex = 23
Top = 5280
Width = 1695
End
Begin VB.CommandButton Command7
Caption = "删除建议"
Height = 285
Left = 4680
TabIndex = 22
Top = 4920
Width = 1695
End
Begin VB.CommandButton Command6
Caption = "查看内容"
Height = 285
Left = 3120
TabIndex = 21
Top = 5640
Width = 1335
End
Begin VB.CommandButton Command5
Caption = "查看错误报告"
Height = 285
Left = 1560
TabIndex = 20
Top = 5640
Width = 1455
End
Begin VB.CommandButton Command4
Caption = "查看建议"
Height = 285
Left = 120
TabIndex = 19
Top = 5640
Width = 1335
End
Begin VB.TextBox Text5
Alignment = 1 'Right Justify
BackColor = &H8000000C&
Height = 285
Left = 3120
Locked = -1 'True
TabIndex = 17
Text = "0"
Top = 5280
Width = 375
End
Begin VB.TextBox Text4
Alignment = 1 'Right Justify
BackColor = &H8000000C&
Height = 285
Left = 1560
Locked = -1 'True
TabIndex = 15
Text = "0"
Top = 5280
Width = 375
End
Begin VB.TextBox Text3
Alignment = 1 'Right Justify
BackColor = &H8000000C&
Height = 285
Left = 120
Locked = -1 'True
TabIndex = 13
Text = "0"
Top = 5280
Width = 375
End
Begin VB.TextBox Text2
Height = 285
Left = 240
TabIndex = 10
Top = 3840
Width = 4575
End
Begin MSWinsockLib.Winsock sckListen
Index = 0
Left = 4200
Top = 960
_ExtentX = 741
_ExtentY = 741
_Version = 393216
LocalPort = 6000
End
Begin VB.CommandButton Command3
Caption = "消息"
Height = 285
Left = 4920
TabIndex = 8
Top = 3840
Width = 1455
End
Begin VB.ListBox List1
Height = 2205
ItemData = "Form1.frx":27A2
Left = 5040
List = "Form1.frx":27A4
TabIndex = 7
Top = 840
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "服务器消息"
Height = 285
Left = 4920
TabIndex = 6
Top = 4440
Width = 1455
End
Begin VB.TextBox Text1
Height = 285
Left = 240
TabIndex = 5
Top = 4440
Width = 4575
End
Begin VB.CommandButton Command1
Caption = "关闭服务"
Height = 285
Left = 5040
TabIndex = 4
Top = 3240
Width = 1455
End
Begin VB.Frame Frame1
Caption = "事件日志"
Height = 3495
Left = 120
TabIndex = 0
Top = 120
Width = 4695
Begin MSWinsockLib.Winsock ServiceSocket
Index = 0
Left = 4080
Top = 360
_ExtentX = 741
_ExtentY = 741
_Version = 393216
LocalPort = 6000
End
Begin RichTextLib.RichTextBox RichTextBox1
Height = 3135
Left = 120
TabIndex = 1
Top = 240
Width = 4455
_ExtentX = 7858
_ExtentY = 5530
_Version = 393217
ReadOnly = -1 'True
ScrollBars = 2
TextRTF = $"Form1.frx":27A6
End
End
Begin VB.Frame Frame3
Caption = "服务器消息"
Height = 615
Left = 120
TabIndex = 11
Top = 4200
Width = 6375
End
Begin VB.Frame Frame2
Caption = "消息"
Height = 1215
Left = 120
TabIndex = 9
Top = 3600
Width = 6375
End
Begin VB.Label Label6
Caption = "内容"
Height = 255
Left = 3600
TabIndex = 18
Top = 5280
Width = 855
End
Begin VB.Label Label5
Caption = "错误"
Height = 255
Left = 2040
TabIndex = 16
Top = 5280
Width = 975
End
Begin VB.Label Label4
Caption = "建议"
Height = 255
Left = 600
TabIndex = 14
Top = 5280
Width = 855
End
Begin VB.Label Label1
Caption = "今日报告"
Height = 255
Left = 120
TabIndex = 12
Top = 4920
Width = 1215
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "0 /200"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 5040
TabIndex = 3
Top = 510
Width = 555
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "#连接用户"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 5040
TabIndex = 2
Top = 240
Width = 840
End
Begin VB.Menu mnuFile
Caption = "文件(&F)"
Begin VB.Menu mnuFileBan
Caption = "&Ban"
End
End
Begin VB.Menu mnuUsers
Caption = "用户(&U)"
Visible = 0 'False
Begin VB.Menu mnuUsersKick
Caption = "Kick"
End
Begin VB.Menu mnuUsersBan
Caption = "Ban"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'==================
'聊天系统服务端程序
'处理服务信息,连接客户端
'==================
Option Explicit
Public intMax As Integer '最大用户数
Public FilePath As String '文件路径
Public TotalUsersOnline As Integer '在用户数
Dim gFileNum As Long '文件大小
Dim gRecordLen As Long '记录大小
Dim gCurrentRecord As Long '当前记录
Dim gLastRecord As Long '最后一条记录
Dim LastConnection As Integer '最后一次连接
Dim u As Integer
Dim a As Integer
'=================
'停止服务器
'================
Private Sub Command1_Click()
On Error Resume Next
'如果为关闭状态,则启动服务,如果为启动状态,点击则关闭服务
If Command1.Caption = "启动服务" Then
Command1.Caption = "关闭服务"
Else
Command1.Caption = "启动服务"
For u = 0 To Val(Word(Label3.Caption, 1))
'保存服务日志
ServiceSocket(u).SendData ".LogOff"
RichTextBox1.SelText = Now & ": User " & ServiceSocket(u).Name & " logged off from " & ServiceSocket(u).RemoteHostIP & vbCrLf
Next u
End If
End Sub
'================
'发送服务器消息
'================
Private Sub Command2_Click()
If Text1.Text = "" Then
'没有输入任何信息
MsgBox "您没有输入任何消息"
Else
For u = 0 To intMax
If ServiceSocket(u).State = 7 Then
'发送SOCKET消息
ServiceSocket(u).SendData ".ServerMessage " & Text1.Text
End If
Next
'清空文本框
Text1.Text = ""
End If
End Sub
'=================
'发送普通消息
'==================
Private Sub Command3_Click()
Dim TempInt As Integer
On Error GoTo PMessageError
TempInt = List1.ItemData(List1.ListIndex)
If ServiceSocket(TempInt).State = 7 Then
'没有输入任何信息
If Text2.Text = "" Then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -