📄 frmserver.frm
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmServer
Caption = "server"
ClientHeight = 4515
ClientLeft = 60
ClientTop = 450
ClientWidth = 7215
LinkTopic = "Form1"
ScaleHeight = 4515
ScaleWidth = 7215
StartUpPosition = 3 '窗口缺省
Begin MSAdodcLib.Adodc Adodc1
Height = 495
Left = 4680
Top = 480
Visible = 0 'False
Width = 1335
_ExtentX = 2355
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSWinsockLib.Winsock tcpServer
Index = 0
Left = 2280
Top = 2520
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
End
Attribute VB_Name = "frmServer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Num As Integer
Dim flag As Boolean
Dim NumOnline As Integer
Dim clientName(1 To 5)
Private Sub Form_Load()
Num = 0
NumOnline = 0
tcpServer(0).LocalPort = 5000
tcpServer(0).Listen
With Adodc1
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\data\song.mdb;Persist Security Info=False"
.CommandTimeout = 30
.CommandType = adCmdText
.CursorLocation = adUseClient
.Refresh
End With
End Sub
Private Sub tcpServer_ConnectionRequest(Index As Integer, ByVal requestID As Long)
If Index = 0 Then
Num = Num + 1
NumOnline = NumOnline + 1
Load tcpServer(Num)
tcpServer(Num).LocalPort = 0
tcpServer(Num).Accept requestID
End If
End Sub
Private Sub tcpServer_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim s As String
Dim s1 As String
Dim ss As String
serverN = Index
tcpServer(Index).GetData s
'分析数据判断是系统命令还是发送的曲目编号
ss = Left$(s, 1)
s = Mid$(s, 2, Len(s) - 1)
On Error Resume Next
If ss = "N" Then '歌曲编号
Adodc1.RecordSource = "select 位置 from songlist where 编号='" & s & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <> 0 Then
frmPlayer.WMPlayer1.URL = Adodc1.Recordset.Fields("位置")
frmPlayer.WMPlayer1.Controls.play
Else
'向操作台发出没有曲止信息
s1 = "Err001"
tcpServer(Index).SendData s1
End If
ElseIf ss = "S" Then
Select Case s
Case Is = "pause"
frmPlayer.WMPlayer1.Controls.pause
Case Is = "play"
frmPlayer.WMPlayer1.Controls.play
Case Is = "stop"
frmPlayer.WMPlayer1.Controls.stop
End Select
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -