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

📄 form1.frm

📁 this file explains how to build a communication with another pc using winsock common control compo
💻 FRM
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Form Client"
   ClientHeight    =   3195
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdkirim 
      Caption         =   "Send"
      Height          =   375
      Left            =   3360
      TabIndex        =   4
      Top             =   960
      Width           =   735
   End
   Begin VB.CommandButton cmddisc 
      Caption         =   "Disconnect"
      Height          =   375
      Left            =   2040
      TabIndex        =   3
      Top             =   960
      Width           =   1215
   End
   Begin VB.CommandButton cmdconect 
      Caption         =   "Connect"
      Height          =   375
      Left            =   720
      TabIndex        =   2
      Top             =   960
      Width           =   1215
   End
   Begin VB.TextBox txpesan 
      Height          =   285
      Left            =   720
      TabIndex        =   1
      Top             =   600
      Width           =   3375
   End
   Begin MSWinsockLib.Winsock wskclient 
      Left            =   1680
      Top             =   2400
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
   Begin VB.Label Label1 
      Caption         =   "Pesan"
      Height          =   255
      Left            =   720
      TabIndex        =   0
      Top             =   360
      Width           =   855
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub cmdconect_Click()

    wskclient.Close
    wskclient.Connect
    
End Sub


Private Sub cmddisc_Click()

    wskclient.Close
    
    cmdconect.Enabled = True
    cmddisc.Enabled = False
    cmdkirim.Enabled = False
    
End Sub


Private Sub cmdkirim_Click()

    wskclient.SendData txpesan.Text
    
    txpesan.Text = ""
    
End Sub


Private Sub Form_Load()

    cmdconect.Enabled = True
    cmddisc.Enabled = False
    cmdkirim.Enabled = False
    
    wskclient.RemoteHost = "192.168.0.2"
    wskclient.RemotePort = 3030
    
End Sub



Private Sub wskclient_Close()

    wskclient.Close
    
    cmdconect.Enabled = True
    cmddisc.Enabled = False
    cmdkirim.Enabled = False
    
End Sub

Private Sub wskclient_Connect()

    cmdconect.Enabled = False
    cmddisc.Enabled = True
    cmdkirim.Enabled = True
    
End Sub

⌨️ 快捷键说明

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