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

📄 form1.frm

📁 简单的局域网内文件发送程序的源码。
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form Form1 
   Caption         =   "c"
   ClientHeight    =   3090
   ClientLeft      =   5040
   ClientTop       =   3090
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   Begin VB.CommandButton Command4 
      Caption         =   "发送"
      Height          =   375
      Left            =   3480
      TabIndex        =   4
      Top             =   2400
      Width           =   855
   End
   Begin MSWinsockLib.Winsock W 
      Left            =   600
      Top             =   120
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
   Begin MSComDlg.CommonDialog C 
      Left            =   0
      Top             =   0
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton Command3 
      Caption         =   "选择文件"
      Height          =   375
      Left            =   360
      TabIndex        =   2
      Top             =   2400
      Width           =   855
   End
   Begin VB.CommandButton Command2 
      Caption         =   "发送文件名"
      Height          =   375
      Left            =   2280
      TabIndex        =   1
      Top             =   2400
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "连 接"
      Height          =   375
      Left            =   1320
      TabIndex        =   0
      Top             =   2400
      Width           =   855
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Height          =   180
      Left            =   720
      TabIndex        =   3
      Top             =   120
      Width           =   90
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Filename As String, Shortfilename As String, Lenstr As Long, data As Byte, lenfile As Long

Private Sub Command1_Click()
W.RemoteHost = InputBox("")
W.RemotePort = "2008"
W.Connect
End Sub

Private Sub Command2_Click()
W.SendData Shortfilename
End Sub

Private Sub Command3_Click()
C.ShowOpen
Filename = C.Filename
Open Filename For Binary As #1
Label1.Caption = Filename
For i = 1 To Len(Filename)
  If Mid$(Filename, i, 1) = "\" Then Lenstr = i
Next i
Shortfilename = Right$(Filename, Len(Filename) - Lenstr)
End Sub

Private Sub Command4_Click()
  lenfile = FileLen(Filename)
  For i = 1 To lenfile
    DoEvents
    Get #1, , data
    W.SendData data
  Next i
    MsgBox "ok"
End Sub

Private Sub W_Connect()
  MsgBox "连接上"
End Sub

⌨️ 快捷键说明

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