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

📄 main.frm

📁 一个VB做的语音系统控件
💻 FRM
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.MDIForm main 
   BackColor       =   &H8000000C&
   Caption         =   "语音聊天室管理系统"
   ClientHeight    =   5700
   ClientLeft      =   165
   ClientTop       =   450
   ClientWidth     =   7800
   Icon            =   "main.frx":0000
   LinkTopic       =   "MDIForm1"
   StartUpPosition =   2  '屏幕中心
   Begin ComctlLib.Toolbar Toolbar 
      Align           =   1  'Align Top
      Height          =   420
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   7800
      _ExtentX        =   13758
      _ExtentY        =   741
      ButtonWidth     =   635
      ButtonHeight    =   582
      Appearance      =   1
      ImageList       =   "ImageList"
      _Version        =   327682
      BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7} 
         NumButtons      =   4
         BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7} 
            Key             =   ""
            Object.Tag             =   ""
            Style           =   3
            MixedState      =   -1  'True
         EndProperty
         BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7} 
            Caption         =   ""
            Key             =   ""
            Description     =   ""
            Object.ToolTipText     =   "开始服务"
            Object.Tag             =   ""
            ImageIndex      =   1
         EndProperty
         BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7} 
            Caption         =   ""
            Key             =   ""
            Description     =   ""
            Object.ToolTipText     =   "暂停服务"
            Object.Tag             =   ""
            ImageIndex      =   2
         EndProperty
         BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7} 
            Caption         =   ""
            Key             =   ""
            Description     =   ""
            Object.ToolTipText     =   "关闭服务"
            Object.Tag             =   ""
            ImageIndex      =   3
         EndProperty
      EndProperty
   End
   Begin ComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   255
      Left            =   0
      TabIndex        =   1
      Top             =   5445
      Width           =   7800
      _ExtentX        =   13758
      _ExtentY        =   450
      Style           =   1
      SimpleText      =   ""
      _Version        =   327682
      BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} 
         NumPanels       =   1
         BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
            Key             =   ""
            Object.Tag             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.Timer refresh_time 
      Interval        =   60000
      Left            =   3480
      Top             =   3240
   End
   Begin MSWinsockLib.Winsock sckServer 
      Index           =   0
      Left            =   3120
      Top             =   3240
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
   Begin MSWinsockLib.Winsock sckListen 
      Left            =   2760
      Top             =   3240
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
   Begin ComctlLib.ImageList ImageList 
      Left            =   2160
      Top             =   3120
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   327682
      BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
         NumListImages   =   3
         BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "main.frx":014A
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "main.frx":04E4
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "main.frx":087E
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.Menu menu_system 
      Caption         =   "系统(&S)"
      Begin VB.Menu menu_system_room 
         Caption         =   "房间设置"
         Shortcut        =   ^R
      End
      Begin VB.Menu menu_system_temp1 
         Caption         =   "-"
      End
      Begin VB.Menu menu_system_exit 
         Caption         =   " 退  出 "
         Shortcut        =   ^X
      End
   End
   Begin VB.Menu menu_manage 
      Caption         =   "管理(&M)"
      Begin VB.Menu menu_manage_user 
         Caption         =   "用户管理"
         Shortcut        =   ^U
      End
      Begin VB.Menu menu_manage_active 
         Caption         =   "在线管理"
         Shortcut        =   ^A
      End
   End
   Begin VB.Menu menu_about 
      Caption         =   "关于(&A)"
      Begin VB.Menu menu_about_about 
         Caption         =   "关于"
         Shortcut        =   ^B
      End
      Begin VB.Menu menu_about_help 
         Caption         =   "帮助"
         Shortcut        =   ^H
      End
   End
End
Attribute VB_Name = "main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub MDIForm_Load()
   Dim NowTime As Date
   NowTime = "2002-11-18"
   If DateDiff("d", NowTime, Date) > 10 Then
       MsgBox "测试期已过", vbOKOnly, "提示"
       End
    End If
   Call ConnectDataBase(db_host, db_name, db_user, db_pass)
   Call InitRoom
   Call start_server
End Sub

Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
   If MsgBox("确认退出系统吗?", vbOKCancel, "提示") = vbOK Then
       End
   Else
      Cancel = -1
   End If
End Sub

Private Sub menu_manage_active_Click()
  active.Show
End Sub

Private Sub menu_manage_user_Click()
   user_setup.Show
  End Sub


Private Sub menu_system_exit_Click()
   Unload Me
End Sub

Private Sub menu_system_room_Click()
  room_setup.Show
End Sub

Private Sub refresh_time_Timer()
   StatusBar1.SimpleText = Now()
   Call CloseAllMic
End Sub

Private Sub Toolbar_ButtonClick(ByVal Button As ComctlLib.Button)
  Select Case Button.index
     Case 2
       Call start_server
    Case 3
       Call pause_server
    Case 4
       Call stop_server
  End Select
End Sub

Private Sub sckListen_ConnectionRequest(ByVal requestID As Long) '决定由哪一Winsock接受请求
  Dim i As Integer
  For i = 0 To sckServer.Count - 1
   If sckServer(i).State = 0 Then
    sckServer(i).Accept requestID
    Exit Sub
    Exit For
   End If
  Next i
  Load sckServer(sckServer.Count)
  sckServer(sckServer.Count - 1).Accept requestID
End Sub

Private Sub sckListen_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
  Call start_server
End Sub

Private Sub sckServer_Close(index As Integer)
 Call UserLogout(index)
End Sub

Private Sub sckServer_DataArrival(index As Integer, ByVal bytesTotal As Long)
  Dim s As Variant
  Dim i As Integer
  sckServer(index).GetData s
  If bytesTotal <= 60 Then
      Call ProcessData(s, index)
      Exit Sub
    Else
        If Len(s) <> 162 And Len(s) <> 325 Then Exit Sub
        For i = 0 To sckServer.Count - 1 Step 1
         If sckServer(i).State = 7 And index <> i And User_info(index).RoomID = User_info(i).RoomID Then
             sckServer(i).SendData s
             DoEvents
         End If
        Next i
    End If
End Sub


Private Sub sckServer_Error(index As Integer, ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
  sckServer(index).Close
End Sub

⌨️ 快捷键说明

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