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

📄 form1.frm

📁 this is very help full for chat in vb 6.0
💻 FRM
字号:
VERSION 5.00
Object = "{D01BD6BE-456A-4078-AEBF-3ACB85261FA6}#3.0#0"; "VCProX.ocx"
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Chat :: (C) Lake of Soft"
   ClientHeight    =   5130
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4935
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5130
   ScaleWidth      =   4935
   StartUpPosition =   3  'Windows Default
   Begin VCProX.vcproWaveInDeviceX waveIn 
      Height          =   1095
      Left            =   0
      TabIndex        =   12
      Top             =   600
      Visible         =   0   'False
      Width           =   855
      Active          =   0   'False
      AutoActivate    =   -1  'True
      CalcVolume      =   0   'False
      DumpInput       =   ""
      IsFormatProvider=   -1  'True
      MinActiveTime   =   0
      MinVolumeLevel  =   0
      OverNum         =   5
      PcmBitsPerSample=   16
      PcmNumChannels  =   2
      PcmSamplesPerSec=   44100
      DumpOutput      =   ""
      DeviceId        =   -1
      DeviceDirect    =   0   'False
      DeviceMapped    =   0   'False
      SyncEvents      =   0   'False
   End
   Begin VCProX.vcproMediaGateX Gate 
      Height          =   735
      Left            =   600
      TabIndex        =   0
      Top             =   3480
      Visible         =   0   'False
      Width           =   1260
      Active          =   0   'False
      DeviceId        =   -1
      FormatTag       =   49
      Port            =   "17820"
      Proto           =   0
      PcmBitsPerSample=   16
      PcmNumChannels  =   1
      PcmSamplesPerSec=   44100
      MaxClients      =   1
      EnableRecording =   -1  'True
      EnablePlayback  =   -1  'True
      SyncEvents      =   0   'False
      MinActiveTime   =   0
      MinVolumeLevel  =   0
      BindTo          =   ""
      ConversationSaveToFile=   0   'False
      ConversationFileName=   ""
      OverNum         =   25
   End
   Begin VB.CommandButton btnQuality 
      Caption         =   "Quality..."
      Height          =   375
      Left            =   3600
      TabIndex        =   26
      Top             =   600
      Width           =   1215
   End
   Begin VB.Timer Timer1 
      Interval        =   500
      Left            =   2880
      Top             =   3720
   End
   Begin VB.Frame Frame3 
      Caption         =   "Text messages"
      Height          =   1575
      Left            =   120
      TabIndex        =   19
      Top             =   2880
      Width           =   4695
      Begin VB.TextBox Text2 
         BackColor       =   &H8000000F&
         Height          =   975
         Left            =   120
         Locked          =   -1  'True
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   21
         Top             =   480
         Width           =   2175
      End
      Begin VB.TextBox Text3 
         Height          =   975
         Left            =   2400
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   20
         Text            =   "Form1.frx":0000
         Top             =   480
         Width           =   2175
      End
      Begin VB.Label Label9 
         AutoSize        =   -1  'True
         Caption         =   "Outgoing"
         Height          =   195
         Left            =   2400
         TabIndex        =   23
         Top             =   240
         Width           =   645
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "Incoming"
         Height          =   195
         Left            =   120
         TabIndex        =   22
         Top             =   240
         Width           =   645
      End
   End
   Begin VB.CommandButton btnDisconnect 
      Caption         =   "Disconnect"
      Height          =   375
      Left            =   3720
      TabIndex        =   18
      Top             =   2400
      Width           =   1095
   End
   Begin VB.TextBox Text4 
      Height          =   315
      Left            =   3840
      TabIndex        =   15
      Text            =   "17820"
      Top             =   1440
      Width           =   975
   End
   Begin VB.ComboBox Combo3 
      Height          =   315
      ItemData        =   "Form1.frx":001C
      Left            =   2160
      List            =   "Form1.frx":0026
      Style           =   2  'Dropdown List
      TabIndex        =   13
      Top             =   1440
      Width           =   855
   End
   Begin VB.CommandButton btnPlaySetup 
      Caption         =   "Setup..."
      Height          =   315
      Left            =   2160
      TabIndex        =   11
      Top             =   910
      Width           =   855
   End
   Begin VB.CommandButton btnRecSetup 
      Caption         =   "Setup..."
      Height          =   315
      Left            =   2160
      TabIndex        =   10
      Top             =   560
      Width           =   855
   End
   Begin VB.ComboBox Combo1 
      Height          =   315
      Left            =   960
      Style           =   2  'Dropdown List
      TabIndex        =   8
      Top             =   120
      Width           =   3855
   End
   Begin VB.CheckBox Check3 
      Caption         =   "Playback"
      Height          =   255
      Left            =   960
      TabIndex        =   7
      Top             =   960
      Value           =   1  'Checked
      Width           =   1095
   End
   Begin VB.CheckBox Check2 
      Caption         =   "Recording"
      Height          =   255
      Left            =   960
      TabIndex        =   6
      Top             =   600
      Value           =   1  'Checked
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Height          =   315
      Left            =   960
      TabIndex        =   3
      Text            =   "192.168.1.1"
      Top             =   2400
      Width           =   1335
   End
   Begin VB.CommandButton btnConnect 
      Caption         =   "Connect"
      Height          =   375
      Left            =   2520
      TabIndex        =   2
      Top             =   2400
      Width           =   1095
   End
   Begin VB.CheckBox Check1 
      Caption         =   "Ready for chat (accept incoming requests)"
      Height          =   255
      Left            =   120
      TabIndex        =   1
      Top             =   2040
      Value           =   1  'Checked
      Width           =   4575
   End
   Begin VB.Label Label11 
      AutoSize        =   -1  'True
      Caption         =   "Label11"
      Height          =   195
      Left            =   2520
      TabIndex        =   25
      Top             =   4560
      Width           =   570
   End
   Begin VB.Label Label10 
      AutoSize        =   -1  'True
      Caption         =   "Label10"
      Height          =   195
      Left            =   2520
      TabIndex        =   24
      Top             =   4800
      Width           =   570
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      Caption         =   "Chat with"
      Height          =   195
      Left            =   120
      TabIndex        =   17
      Top             =   2430
      Width           =   660
   End
   Begin VB.Line Line1 
      X1              =   120
      X2              =   4800
      Y1              =   1920
      Y2              =   1920
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      Caption         =   "Port"
      Height          =   195
      Left            =   3360
      TabIndex        =   16
      Top             =   1485
      Width           =   285
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      Caption         =   "Protocol"
      Height          =   195
      Left            =   1200
      TabIndex        =   14
      Top             =   1485
      Width           =   585
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "Device"
      Height          =   255
      Left            =   120
      TabIndex        =   9
      Top             =   180
      Width           =   615
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "Label2"
      Height          =   195
      Left            =   120
      TabIndex        =   5
      Top             =   4800
      Width           =   480
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Label1"
      Height          =   195
      Left            =   120
      TabIndex        =   4
      Top             =   4560
      Width           =   480
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub ConfigureGate()
    Gate.DeviceId = Combo1.ListIndex
    'Gate.PcmNumChannels = 1 'mono
    If Combo3.ListIndex = 0 Then Gate.Proto = unapt_TCP Else Gate.Proto = unapt_UDP
    Gate.Port = Val(Text4.Text)
End Sub

Private Sub btnConnect_Click()
    ConfigureGate
    Gate.Connect Text1.Text
End Sub

Private Sub btnDisconnect_Click()
    Gate.Disconnect
End Sub

Private Sub btnPlaySetup_Click()
    Shell "sndvol32 /p /d" + Str(Combo1.ListIndex), vbNormalFocus
End Sub

Private Sub btnQuality_Click()
    Gate.FormatChoose "Sound quality", Handle
End Sub

Private Sub btnRecSetup_Click()
    Shell "sndvol32 /r /d" + Str(Combo1.ListIndex), vbNormalFocus
End Sub

Private Sub Check1_Click()
    If Check1.Value = 1 Then ConfigureGate
    Gate.Active = (Check1.Value = 1)
End Sub

Private Sub Check2_Click()
    Gate.EnableRecording = Check2.Value = 1
End Sub

Private Sub Check3_Click()
    Gate.EnablePlayback = Check3.Value = 1
End Sub

Private Sub Form_Load()
    For i = 0 To waveIn.GetDeviceCount - 1
        Combo1.AddItem (waveIn.GetDeviceName(i))
    Next
    
    Combo1.ListIndex = 0
    Combo3.ListIndex = 1

    If Check1.Value = 1 Then
        ConfigureGate
        Gate.Active = True
    End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Timer1.Enabled = False
    Gate.Active = False
End Sub

Private Sub Gate_OnReceiveText(ByVal ConnId As Long, ByVal Text As String)
    Text2.Text = Text
    Text2.SelLength = 0
    Text2.SelStart = Len(Text2.Text)
End Sub

Private Sub Text3_Change()
    Gate.SendText 0, Text3.Text
End Sub

Private Sub Timer1_Timer()
    btnQuality.Enabled = (Not Gate.Active) And (Not Gate.IsClientActive)

    btnConnect.Enabled = Not Gate.IsClientActive
    btnDisconnect.Enabled = Gate.IsClientActive
    
    Text3.Enabled = (Gate.IsClientActive) Or ((Gate.IsServerActive) And (Gate.ClientCount > 0))
    
    If Gate.IsServerActive Then Label1.Caption = "server: active" Else Label1.Caption = "server: inactive"
    If Gate.IsClientActive Then Label2.Caption = "client: active" Else Label2.Caption = "client: inactive"
    
    Label10.Caption = "bytes sent: " + Str(Gate.BytesSent)
    Label11.Caption = "bytes received: " + Str(Gate.BytesReceived)
End Sub

⌨️ 快捷键说明

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