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

📄 form1.frm

📁 简单的聊天程序!很好用的。你会很容易地自己编写出自己的聊天程序。
💻 FRM
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "mswinsck.ocx"
Begin VB.Form Form1 
   Caption         =   "sz聊天"
   ClientHeight    =   6945
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7035
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   6945
   ScaleWidth      =   7035
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "发送"
      Height          =   375
      Left            =   2760
      TabIndex        =   3
      Top             =   5640
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "退出"
      Height          =   375
      Left            =   480
      TabIndex        =   2
      Top             =   5640
      Width           =   1335
   End
   Begin MSWinsockLib.Winsock Winsockserver 
      Left            =   3840
      Top             =   6240
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
   Begin VB.TextBox textget 
      Height          =   3255
      Left            =   360
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   1
      Top             =   480
      Width           =   4095
   End
   Begin VB.TextBox textsend 
      Height          =   1215
      Left            =   360
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   0
      Top             =   4080
      Width           =   4095
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private MaxChan As Integer
Private Sub Command1_Click()

     End

    End Sub

   

Private Sub Command2_Click()

     Winsockserver.SendData textsend.Text
     textsend.Text = ""
End Sub

    
   
   Private Sub Form_Load()

     textsend.Visible = False

     textget.Visible = False
     Command2.Visible = False
     Dim i As Integer
     MaxChan = 15
     For i = 1 To MaxChan - 1
     Load Winsockserver(i)
     Next i
     Winsockserver.LocalPort = 1001

     Winsockserver.Listen

    End Sub

   

   

   

    Private Sub Winsockserver_Close()

     Winsockserver.Close

     End

    End Sub

   

    Private Sub Winsockserver_ConnectionRequest(ByVal requestID As Long)

     textsend.Visible = True

     textget.Visible = True
     Command2.Visible = True

     If Winsockserver.State <> sckClosed Then Winsockserver.Close

     Winsockserver.Accept requestID

    End Sub

   

    Private Sub Winsockserver_DataArrival(ByVal bytesTotal As Long)

     Dim tmpstr As String

     Winsockserver.GetData tmpstr

     textget.Text = tmpstr

    End Sub


⌨️ 快捷键说明

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