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

📄 frmser.frm

📁 本程序使用VB语言编程
💻 FRM
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form frmser 
   Caption         =   "服务器端程序"
   ClientHeight    =   7305
   ClientLeft      =   60
   ClientTop       =   645
   ClientWidth     =   6690
   LinkTopic       =   "Form1"
   Picture         =   "frmser.frx":0000
   ScaleHeight     =   7305
   ScaleWidth      =   6690
   StartUpPosition =   2  '屏幕中心
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   120
      Top             =   5880
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton Command2 
      BackColor       =   &H00FFC0FF&
      Caption         =   "结束聊天"
      Height          =   735
      Left            =   5640
      Picture         =   "frmser.frx":17231
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   240
      Width           =   975
   End
   Begin MSWinsockLib.Winsock Winsockserver 
      Left            =   240
      Top             =   6840
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
   Begin VB.TextBox txtreceive 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   3615
      Left            =   840
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   2
      Top             =   1320
      Width           =   5415
   End
   Begin VB.TextBox txtsend 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1575
      Left            =   840
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   1
      Top             =   5160
      Width           =   5415
   End
   Begin VB.TextBox txtserverip 
      Height          =   375
      Left            =   3600
      TabIndex        =   0
      Top             =   240
      Width           =   1815
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackColor       =   &H00C00000&
      Caption         =   "内容"
      BeginProperty Font 
         Name            =   "华文新魏"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000080FF&
      Height          =   285
      Left            =   120
      TabIndex        =   5
      Top             =   5040
      Width           =   570
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackColor       =   &H00C00000&
      Caption         =   "信息"
      BeginProperty Font 
         Name            =   "华文新魏"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000080FF&
      Height          =   285
      Left            =   120
      TabIndex        =   4
      Top             =   1080
      Width           =   570
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H00C00000&
      Caption         =   "本机现在为服务器,IP为:"
      BeginProperty Font 
         Name            =   "华文新魏"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000080FF&
      Height          =   285
      Left            =   120
      TabIndex        =   3
      Top             =   360
      Width           =   3375
   End
   Begin VB.Menu zt 
      Caption         =   "颜色"
      Begin VB.Menu getinfo 
         Caption         =   "收到的信息"
      End
      Begin VB.Menu sendinfo 
         Caption         =   "发送的信息"
      End
   End
End
Attribute VB_Name = "frmser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
txtreceive.Text = ""
txtsend.Text = ""
Winsockserver.LocalPort = 10001

txtserverip.Text = Winsockserver.LocalIP
Winsockserver.Listen
End Sub

Private Sub getinfo_Click()
CommonDialog1.ShowColor
txtreceive.ForeColor = CommonDialog1.Color
End Sub

Private Sub sendinfo_Click()
CommonDialog1.ShowColor
txtsend.ForeColor = CommonDialog1.Color
End Sub

Private Sub txtsend_Change()
If Winsockserver.RemotePort Then
   Winsockserver.SendData txtserverip.Text & ":" & txtsend.Text
Else
   MsgBox "还没有客户机远程连接!"
End If
End Sub

Private Sub Winsockserver_ConnectionRequest(ByVal requestID As Long)
Winsockserver.Close
Winsockserver.Accept requestID
End Sub

Private Sub Winsockserver_DataArrival(ByVal bytesTotal As Long)
Dim mystr As String
Winsockserver.GetData mystr
txtreceive.Text = mystr
End Sub

⌨️ 快捷键说明

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