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

📄 chat.frm

📁 vb中如何进行网络编程的示例,包括:UDP聊天,TCP聊天,UDP,TCP flood攻击等 非常棒
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.0#0"; "COMCTL32.OCX"
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form frmChat 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Inter Net Voice"
   ClientHeight    =   3030
   ClientLeft      =   2625
   ClientTop       =   1530
   ClientWidth     =   4170
   FillColor       =   &H00808080&
   Icon            =   "chat.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   ScaleHeight     =   3030
   ScaleWidth      =   4170
   WhatsThisButton =   -1  'True
   WhatsThisHelp   =   -1  'True
   Begin VB.PictureBox Picture3 
      Height          =   2565
      Left            =   60
      ScaleHeight     =   2505
      ScaleWidth      =   3945
      TabIndex        =   0
      Top             =   390
      Width           =   4005
      Begin VB.CommandButton cmdTalk 
         Caption         =   "&Talk"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   345
         Left            =   540
         TabIndex        =   4
         Top             =   2130
         Width           =   2865
      End
      Begin VB.ListBox ConnectionList 
         Height          =   1065
         ItemData        =   "chat.frx":0442
         Left            =   60
         List            =   "chat.frx":0444
         TabIndex        =   2
         Top             =   840
         Width           =   3825
      End
      Begin VB.ComboBox txtServer 
         Height          =   315
         ItemData        =   "chat.frx":0446
         Left            =   630
         List            =   "chat.frx":0448
         Sorted          =   -1  'True
         TabIndex        =   1
         Top             =   60
         Width           =   3255
      End
      Begin VB.Image outLight 
         Height          =   345
         Left            =   3510
         Picture         =   "chat.frx":044A
         Stretch         =   -1  'True
         Top             =   2130
         Width           =   345
      End
      Begin VB.Image inLight 
         Height          =   345
         Left            =   60
         Picture         =   "chat.frx":0754
         Stretch         =   -1  'True
         Top             =   2130
         Width           =   345
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "Conference List:"
         Height          =   195
         Left            =   60
         TabIndex        =   3
         Top             =   600
         Width           =   1425
      End
      Begin VB.Image imgStatus 
         Appearance      =   0  'Flat
         Height          =   390
         Left            =   90
         Picture         =   "chat.frx":0A5E
         Stretch         =   -1  'True
         Top             =   30
         Width           =   420
      End
   End
   Begin ComctlLib.Toolbar Tools 
      Align           =   1  'Align Top
      Height          =   390
      Left            =   0
      TabIndex        =   5
      Top             =   0
      Width           =   4170
      _ExtentX        =   7355
      _ExtentY        =   688
      ImageList       =   "ImgIcons"
      BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7} 
         NumButtons      =   5
         BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7} 
            Style           =   3
         EndProperty
         BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7} 
            Object.ToolTipText     =   "Call"
            ImageIndex      =   4
         EndProperty
         BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7} 
            Enabled         =   0   'False
            Object.ToolTipText     =   "Hangup"
            ImageIndex      =   5
         EndProperty
         BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7} 
            Style           =   3
         EndProperty
         BeginProperty Button5 {0713F354-850A-101B-AFC0-4210102A8DA7} 
            Object.ToolTipText     =   "Auto Answering"
            ImageIndex      =   1
            Style           =   1
            Value           =   1
         EndProperty
      EndProperty
   End
   Begin MSWinsockLib.Winsock TCPSocket 
      Index           =   0
      Left            =   3720
      Top             =   3600
      _ExtentX        =   741
      _ExtentY        =   741
   End
   Begin ComctlLib.ImageList ImgIcons 
      Left            =   4290
      Top             =   2070
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
         NumListImages   =   11
         BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "chat.frx":0EA0
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "chat.frx":11BA
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "chat.frx":14D4
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "chat.frx":17EE
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "chat.frx":1B08
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "chat.frx":1E22
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "chat.frx":213C
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "chat.frx":2456
            Key             =   ""
         EndProperty
         BeginProperty ListImage9 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "chat.frx":2770
            Key             =   ""
         EndProperty
         BeginProperty ListImage10 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "chat.frx":2A8A
            Key             =   ""
         EndProperty
         BeginProperty ListImage11 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "chat.frx":2DA4
            Key             =   ""
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "frmChat"
Attribute VB_Base = "0{0E3A2BAD-DE40-11CF-8FDF-D0AF03C10000}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_TemplateDerived = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
Public CLOSINGAPPLICATION As Boolean                    ' Application status flag
Public wStream As Object

'--------------------------------------------------------------
Private Sub cmdTalk_Click()                             ' Activates Audio PlayBack
'--------------------------------------------------------------
    Dim rc As Long                                      ' Return Code Variable
    Dim iPort As Integer                                ' Local Port
    Dim itm As Integer                                  ' Current listitem
'--------------------------------------------------------------
    If (Not wStream.Playing And wStream.PlayDeviceFree And _
        Not wStream.Recording And wStream.RecDeviceFree) Then ' Validate Audio Device Status
        wStream.Playing = True                          ' Turn Playing Status On
        cmdTalk.Caption = "&Playing"                    ' Modify Button Status Caption
        Screen.MousePointer = vbHourglass               ' Set Pointer To HourGlass
        
        iPort = wStream.StreamInQueue
        Do While (iPort <> NULLPORTID)                  ' While socket ports have data to playback
            inLight.Picture = ImgIcons.ListImages(speakON).Picture ' Flash playback image
            inLight.Refresh                             ' Repaint picture image
            
            For itm = 0 To ConnectionList.ListCount - 1 ' Search for listitem currently playing sound data
                If (ConnectionList.ItemData(itm) = iPort) Then ' If a match is found...
                    ConnectionList.TopIndex = itm       ' Set that listitem to top of listbox
                    ConnectionList.Selected(itm) = True ' Select listitem to show who is currently talking...
                    Exit For                            ' Quit listitem search
                End If
            Next                                        ' Check next listitem
            
            rc = wStream.PlayWave(Me.hWnd, iPort)       ' Play wave data in iPort...
            Call wStream.RemoveStreamFromQueue(iPort)   ' Remove PortID From PlayWave Queue
            iPort = wStream.StreamInQueue
            
            inLight.Picture = ImgIcons.ListImages(speakOFF).Picture ' Show done talking image...
            inLight.Refresh                             ' Repaint image...
        Loop                                            ' Search for next socket in playback queue
        
        ConnectionList.TopIndex = 0                     ' Reset top image...
        If (ConnectionList.ListCount > 0) Then
            ConnectionList.Selected(0) = True           ' Deselect previously listitem
            ConnectionList.Selected(0) = False          ' Deselect currently selected listitem
        End If
        Screen.MousePointer = vbDefault                 ' Set Pointer To Normal
        cmdTalk.Caption = "&Talk"                       ' Modify Button Status Caption
        wStream.Playing = False                         ' Turn Playing Status Off
    End If
'--------------------------------------------------------------
End Sub
'--------------------------------------------------------------

'--------------------------------------------------------------
Private Sub cmdTalk_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
' Activates Audio Recording...
'--------------------------------------------------------------
    Dim rc As Long                                      ' Return Code Variable
'--------------------------------------------------------------
    If (Not wStream.Playing And _
        Not wStream.Recording And _
            wStream.RecDeviceFree And _
            wStream.PlayDeviceFree) Then          ' Check Audio Device Status
        wStream.Recording = True                                ' Set Recording Flag
        cmdTalk.Caption = "&Talking"                    ' Update Button Status To "Talking"
        Screen.MousePointer = vbHourglass               ' Set Hourglass
        outLight.Picture = ImgIcons.ListImages(mikeON).Picture ' Show outgoing message image
        outLight.Refresh                                ' Repaint image
        
        rc = wStream.RecordWave(Me.hWnd, TCPSocket)     ' Record voice and send to all connected sockets
        

⌨️ 快捷键说明

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