⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serverform.frm

📁 h to comincate on server using VB 6
💻 FRM
字号:
VERSION 5.00
Object = "{D01BD6BE-456A-4078-AEBF-3ACB85261FA6}#3.0#0"; "VCProX.ocx"
Begin VB.Form serverForm 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Conference Server :: (C) Lake of Soft"
   ClientHeight    =   4125
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4455
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4125
   ScaleWidth      =   4455
   StartUpPosition =   3  'Windows Default
   Begin VCProX.vcproConferenceServerX Conf 
      Height          =   975
      Left            =   3000
      TabIndex        =   11
      Top             =   2520
      Width           =   1335
      Active          =   0   'False
      Port            =   "17820"
      Proto           =   0
      SyncEvents      =   -1  'True
      PcmBitsPerSample=   16
      PcmNumChannels  =   1
      PcmSamplesPerSec=   8000
      FormatTag       =   49
      BindTo          =   "0.0.0.0"
      RemoveEmptyRooms=   0   'False
   End
   Begin VB.Frame Frame2 
      Caption         =   "Audio"
      Height          =   1815
      Left            =   1560
      TabIndex        =   14
      Top             =   120
      Width           =   1335
      Begin VB.ComboBox Combo2 
         Height          =   315
         ItemData        =   "serverForm.frx":0000
         Left            =   120
         List            =   "serverForm.frx":000A
         Style           =   2  'Dropdown List
         TabIndex        =   15
         Top             =   480
         Width           =   1095
      End
      Begin VB.Label Label9 
         Caption         =   "Client software must have the same settings!"
         ForeColor       =   &H000000FF&
         Height          =   675
         Left            =   120
         TabIndex        =   20
         Top             =   1080
         Width           =   1095
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "Sampling rate"
         Height          =   195
         Left            =   120
         TabIndex        =   17
         Top             =   240
         Width           =   960
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "mono"
         Height          =   195
         Left            =   120
         TabIndex        =   16
         Top             =   840
         Width           =   390
      End
   End
   Begin VB.CommandButton btnDisconnectClient 
      Caption         =   "Disconnect"
      Height          =   375
      Left            =   960
      TabIndex        =   13
      Top             =   3600
      Width           =   1215
   End
   Begin VB.TextBox tbClientId 
      Height          =   315
      Left            =   120
      TabIndex        =   12
      Text            =   "ClientId"
      Top             =   3600
      Width           =   735
   End
   Begin VB.TextBox Text4 
      Height          =   975
      Left            =   120
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   5
      Top             =   2520
      Width           =   2775
   End
   Begin VB.TextBox Text3 
      Height          =   315
      Left            =   3000
      Locked          =   -1  'True
      TabIndex        =   4
      Text            =   "Text3"
      Top             =   1440
      Width           =   615
   End
   Begin VB.Frame Frame1 
      Caption         =   "Network"
      Height          =   1815
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   1335
      Begin VB.TextBox Text1 
         Height          =   315
         Left            =   120
         TabIndex        =   7
         Text            =   "17820"
         Top             =   1080
         Width           =   1095
      End
      Begin VB.ComboBox Combo1 
         Height          =   315
         ItemData        =   "serverForm.frx":001B
         Left            =   120
         List            =   "serverForm.frx":0025
         Style           =   2  'Dropdown List
         TabIndex        =   6
         Top             =   480
         Width           =   1095
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "Protocol"
         Height          =   195
         Left            =   120
         TabIndex        =   10
         Top             =   240
         Width           =   585
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "Port"
         Height          =   195
         Left            =   120
         TabIndex        =   9
         Top             =   840
         Width           =   285
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "Label5"
         Height          =   195
         Left            =   120
         TabIndex        =   8
         Top             =   1500
         Width           =   480
      End
   End
   Begin VB.Timer Timer1 
      Interval        =   500
      Left            =   3600
      Top             =   2040
   End
   Begin VB.CommandButton buttonStop 
      Caption         =   "Stop"
      Height          =   375
      Left            =   3000
      TabIndex        =   1
      Top             =   720
      Width           =   1335
   End
   Begin VB.CommandButton buttonStart 
      Caption         =   "Start"
      Height          =   375
      Left            =   3000
      TabIndex        =   0
      Top             =   240
      Width           =   1335
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      Caption         =   "bytes sent: 0"
      Height          =   195
      Left            =   120
      TabIndex        =   19
      Top             =   2280
      Width           =   900
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      Caption         =   "bytes received: 0"
      Height          =   195
      Left            =   120
      TabIndex        =   18
      Top             =   2040
      Width           =   1215
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      Caption         =   "Number of clients"
      Height          =   195
      Left            =   3000
      TabIndex        =   3
      Top             =   1200
      Width           =   1230
   End
End
Attribute VB_Name = "serverForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub btnDisconnectClient_Click()
    Conf.DisconnectClient CInt(tbClientId.Text)
End Sub

Private Sub buttonStart_Click()
    Conf.Proto = Combo1.ListIndex
    Conf.Port = Text1.Text
    Conf.PcmSamplesPerSec = CLng(Combo2.Text)
    Conf.Active = True
End Sub

Private Sub buttonStop_Click()
    Conf.Active = False
End Sub

Private Sub Conf_OnClientConnect(ByVal connid As Long)
    Dim param As String
    param = "id=" + CStr(connid) + "; ip=" + Conf.GetClientParam(connid, cpIpAddress) + "; port=" + Conf.GetClientParam(connid, cpPort)
    Text4.Text = Text4.Text + "connected (" + param + ")" + Chr$(13) + Chr$(10)
    
    Text4.SelLength = 0
    Text4.SelStart = Len(Text4.Text)
End Sub

Private Sub Conf_OnClientDisconnect(ByVal connid As Long)
    Text4.Text = Text4.Text + "disconnected (id=" + CStr(connid) + ")" + Chr$(13) + Chr$(10)
    
    Text4.SelLength = 0
    Text4.SelStart = Len(Text4.Text)
End Sub

Private Sub Conf_OnReceiveText(ByVal connid As Long, ByVal Text As String)
    Dim id As Integer
    For i = 0 To Conf.ClientCount - 1
        id = Conf.GetClientConnId(i)
        If id <> connid Then Conf.SendText id, Text 'don't resend to author
    Next
End Sub

Private Sub Form_Load()
    Conf.AddRoom "name", "password"

    Combo1.ListIndex = 1
    Combo2.ListIndex = 0
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    Timer1.Enabled = False
    Conf.Active = False
End Sub

Private Sub Timer1_Timer()
    buttonStart.Enabled = Not Conf.Active
    buttonStop.Enabled = Not buttonStart.Enabled
    
    If Conf.Active Then Label5.Caption = "active" Else Label5.Caption = "not active"
    Text3.Text = CStr(Conf.ClientCount) + "/" + CStr(Conf.MaxClients)
    
    Label6.Caption = "bytes received: " + CStr(Conf.BytesReceived)
    Label8.Caption = "bytes sent: " + CStr(Conf.BytesSent)
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -