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

📄 formrx.frm

📁 I implemented a perfect file transfer OCX client/server. I created a perfect function to parse and s
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FormRX 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "Server"
   ClientHeight    =   4155
   ClientLeft      =   45
   ClientTop       =   285
   ClientWidth     =   7125
   Icon            =   "FormRX.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4155
   ScaleWidth      =   7125
   StartUpPosition =   2  'CenterScreen
   Begin server.ctlFtp ctlFtpRX 
      Left            =   3240
      Top             =   3780
      _extentx        =   847
      _extenty        =   847
   End
   Begin VB.CommandButton cmdListen 
      Caption         =   "Listen"
      Height          =   330
      Left            =   0
      TabIndex        =   2
      Top             =   3795
      Width           =   1485
   End
   Begin VB.CommandButton cmdDisconnect 
      Caption         =   "Disconnetti client"
      Height          =   330
      Left            =   1560
      TabIndex        =   1
      Top             =   3795
      Width           =   1485
   End
   Begin VB.TextBox txtStatus 
      Appearance      =   0  'Flat
      BackColor       =   &H00000000&
      BeginProperty Font 
         Name            =   "Terminal"
         Size            =   9
         Charset         =   255
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FF00&
      Height          =   3165
      Left            =   0
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   0
      Top             =   525
      Width           =   7095
   End
   Begin VB.Label lblBytesRemaining 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H00800000&
      Height          =   225
      Left            =   4830
      TabIndex        =   8
      Top             =   210
      Width           =   2325
   End
   Begin VB.Label lblBytesReceived 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H00FF0000&
      Height          =   225
      Left            =   2415
      TabIndex        =   7
      Top             =   210
      Width           =   2325
   End
   Begin VB.Label lblTotBytes 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H00FF8080&
      Height          =   225
      Left            =   0
      TabIndex        =   6
      Top             =   210
      Width           =   2325
   End
   Begin VB.Label Label4 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "Total lenght"
      ForeColor       =   &H00FF8080&
      Height          =   225
      Left            =   0
      TabIndex        =   5
      Top             =   0
      Width           =   2325
   End
   Begin VB.Label Label5 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "Bytes received"
      ForeColor       =   &H00FF0000&
      Height          =   225
      Left            =   2415
      TabIndex        =   4
      Top             =   0
      Width           =   2325
   End
   Begin VB.Label Label6 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "Bytes remaining"
      ForeColor       =   &H00800000&
      Height          =   225
      Left            =   4830
      TabIndex        =   3
      Top             =   0
      Width           =   2325
   End
End
Attribute VB_Name = "FormRX"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit



Private Sub Form_Load()
    cmdListen_Click
End Sub

Private Sub cmdListen_Click()
    With ctlFtpRX
        '.bufferSize = 1024
        .localPort = 20000
        .Listen
        txtStatus.Text = txtStatus.Text & "Socket listen..." & vbCrLf
    End With
End Sub

Private Sub ctlFtpRX_Connect()
    txtStatus.Text = txtStatus.Text & "Remote host connected..." & vbCrLf
End Sub

Private Sub ctlFtpRX_ConnectionRequest(ByVal requestID As Long)
    txtStatus.Text = txtStatus.Text & "Connection request..." & vbCrLf
    ctlFtpRX.CloseSck
    ctlFtpRX.Accept requestID
    txtStatus.Text = txtStatus.Text & "Connection accepted, remote host connected..." & vbCrLf
End Sub

Private Sub ctlFtpRX_CloseSck()
    ctlFtpRX.CloseSck
    txtStatus.Text = txtStatus.Text & "Connessione chiusa." & vbCrLf
End Sub

Private Sub ctlFtpRX_TransferComplete()
    MsgBox "Transfer complete!", vbInformation
End Sub

Private Sub ctlFtpRX_fileBytesReceived(ByVal bytesTotal As Double, ByVal bytesReceived As Double, ByVal bytesRemaining As Double)
    lblTotBytes.Caption = Format(bytesTotal, "##,##0")
    lblBytesReceived.Caption = Format(bytesReceived, "##,##0")
    lblBytesRemaining.Caption = Format(bytesRemaining, "##,##0")
End Sub

Private Sub ctlFtpRX_Error(ByVal Number As Integer, Description As String, ByVal sCode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    txtStatus.Text = txtStatus.Text & "errore: N." & Number & "- desc. " & Description & vbCrLf
    ctlFtpRX.CloseSck
End Sub

Private Sub cmdDisconnect_Click()
    ctlFtpRX.CloseSck
    
    If ctlFtpRX.Status = sck_Closed Then
        txtStatus.Text = txtStatus.Text & "No active connection..." & vbCrLf
    Else
        txtStatus.Text = txtStatus.Text & "Connection in append..." & vbCrLf
    End If
    
End Sub

⌨️ 快捷键说明

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