📄 form1.frm
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form MainFrm
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = "文件互传 V1.03"
ClientHeight = 4725
ClientLeft = 2385
ClientTop = 1800
ClientWidth = 5805
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4725
ScaleWidth = 5805
StartUpPosition = 2 '屏幕中心
Begin VB.Timer flash
Enabled = 0 'False
Interval = 900
Left = 3300
Top = 2400
End
Begin 工程1.chameleonButton helpbutton
Height = 315
Left = 5040
TabIndex = 22
ToolTipText = "查看本机IP信息\设置程序的端口及其他选项."
Top = 0
Width = 735
_ExtentX = 1296
_ExtentY = 556
BTYPE = 3
TX = "项目"
ENAB = -1 'True
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
COLTYPE = 1
FOCUSR = -1 'True
BCOL = 13160660
FCOL = 0
End
Begin MSWinsockLib.Winsock Winsock2
Left = 1140
Top = 1980
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin 工程1.Xp_ProgressBar XpPB2
Height = 255
Left = 60
TabIndex = 14
Top = 3420
Width = 5655
_ExtentX = 9975
_ExtentY = 450
ProgressLook = 3
End
Begin 工程1.chameleonButton Chart
Height = 615
Left = 5520
TabIndex = 13
ToolTipText = "打开/关闭简短信息发送窗口"
Top = 1860
Width = 255
_ExtentX = 450
_ExtentY = 1085
BTYPE = 3
TX = ">"
ENAB = -1 'True
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
COLTYPE = 1
FOCUSR = -1 'True
BCOL = 13160660
FCOL = 0
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 5000
Left = 3120
Top = 1320
End
Begin MSWinsockLib.Winsock Winsock1
Left = 720
Top = 1980
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin 工程1.chameleonButton SDFileStart
Height = 675
Left = 4260
TabIndex = 12
ToolTipText = "开始向对方发送文件"
Top = 1680
Width = 1215
_ExtentX = 2143
_ExtentY = 1191
BTYPE = 3
TX = "开始发送"
ENAB = -1 'True
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
COLTYPE = 1
FOCUSR = -1 'True
BCOL = 13160660
FCOL = 0
End
Begin 工程1.chameleonButton TCPconnect
Default = -1 'True
Height = 375
Left = 4320
TabIndex = 11
ToolTipText = "与对方建立连接,如果IP栏为空的话,则监听端口等待对方连接"
Top = 3840
Width = 1155
_ExtentX = 2037
_ExtentY = 661
BTYPE = 3
TX = "连接"
ENAB = -1 'True
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
COLTYPE = 1
FOCUSR = -1 'True
BCOL = 13160660
FCOL = 0
End
Begin 工程1.chameleonButton state
Height = 315
Left = 0
TabIndex = 10
Top = 4380
Width = 5775
_ExtentX = 10186
_ExtentY = 556
BTYPE = 3
TX = ""
ENAB = 0 'False
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
COLTYPE = 1
FOCUSR = -1 'True
BCOL = 13160660
FCOL = 0
End
Begin 工程1.Xp_ProgressBar XpPB1
Height = 255
Left = 60
TabIndex = 8
Top = 2880
Width = 5655
_ExtentX = 9975
_ExtentY = 450
End
Begin VB.TextBox ipaddress
Alignment = 2 'Center
ForeColor = &H00FF0000&
Height = 270
Left = 1860
MaxLength = 255
TabIndex = 6
ToolTipText = "在这里填上对方的IP地址或者域名(如与对方同处一个局域网中也可直接填写对方的机器名称)"
Top = 3900
Width = 2295
End
Begin VB.Frame FileInFo
BackColor = &H00E0E0E0&
Caption = "文件信息"
Height = 1215
Left = 360
TabIndex = 3
Top = 1140
Width = 3615
Begin VB.Timer gtjindu
Enabled = 0 'False
Interval = 1000
Left = 2340
Top = 180
End
Begin VB.Timer sdjindu
Enabled = 0 'False
Interval = 1000
Left = 3180
Top = 180
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "文件名称:"
ForeColor = &H00FF0000&
Height = 615
Left = 180
TabIndex = 5
Top = 540
Width = 3255
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "文件大小:"
ForeColor = &H00FF0000&
Height = 255
Left = 180
TabIndex = 4
Top = 240
Width = 3255
End
End
Begin 工程1.chameleonButton SDFilebrowse
Height = 315
Left = 4260
TabIndex = 2
ToolTipText = "浏览选择你要发送的文件"
Top = 900
Width = 1215
_ExtentX = 2143
_ExtentY = 556
BTYPE = 3
TX = "浏览..."
ENAB = -1 'True
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
COLTYPE = 1
FOCUSR = -1 'True
BCOL = 13160660
FCOL = 0
End
Begin VB.TextBox sdfilepath
Enabled = 0 'False
Height = 270
Left = 360
TabIndex = 0
ToolTipText = "这是要发送的文件的全部路径,你可以手动填写也可以通过点击右下的浏览按钮浏览文件"
Top = 600
Width = 5115
End
Begin VB.Label Label12
BackStyle = 0 'Transparent
Height = 195
Left = 3000
TabIndex = 21
Top = 3180
Width = 1395
End
Begin VB.Label Label11
BackStyle = 0 'Transparent
Height = 195
Left = 3000
TabIndex = 20
Top = 2640
Width = 1395
End
Begin VB.Label Label10
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 195
Left = 1380
TabIndex = 19
Top = 3180
Width = 1575
End
Begin VB.Label Label9
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 195
Left = 1380
TabIndex = 18
Top = 2640
Width = 1575
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Height = 195
Left = 4500
TabIndex = 17
Top = 3180
Width = 1215
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Height = 195
Left = 4500
TabIndex = 16
Top = 2640
Width = 1155
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "接收进度显示:"
Height = 180
Left = 120
TabIndex = 15
Top = 3180
Width = 1170
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "发送进度显示:"
Height = 180
Left = 120
TabIndex = 9
Top = 2640
Width = 1170
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "对方IP地址:"
Height = 180
Left = 780
TabIndex = 7
Top = 3960
Width = 990
End
Begin VB.Label label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "要发送的文件:[ 请点击""浏览""按钮选择要发送的文件 ]"
Height = 180
Left = 360
TabIndex = 1
Top = 300
Width = 4410
End
Begin VB.Menu MainMenu
Caption = "MainMenu"
Visible = 0 'False
Begin VB.Menu IPinfo
Caption = "本机IP信息(&I)"
End
Begin VB.Menu OPtion
Caption = "占用端口和其他设置(&O)"
End
Begin VB.Menu proxy
Caption = "代理服务器设置(&P)"
End
Begin VB.Menu aaaaaaaa
Caption = "-"
End
Begin VB.Menu ViewLog
Caption = "查看日志记录(&L)"
End
Begin VB.Menu chartSave
Caption = "保存简短信息(&C)"
End
Begin VB.Menu chartFrmshow
Caption = "简短消息发送窗口(&F)"
End
Begin VB.Menu bbbbbbbbbbbbbbb
Caption = "-"
End
Begin VB.Menu help
Caption = "使用帮助(&H)"
End
Begin VB.Menu about
Caption = "关于(&A)"
End
End
End
Attribute VB_Name = "MainFrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim strSdFilePath As String '发送文件的路径
Dim strSdFilename As String '发送文件的名称
Dim lngSdFilesize As Long '发送文件的大小
Dim strGtFilepath As String '接收到的文件要存放的路径
Dim strGtFilename As String '接收到的文件名称
Dim lngGtFilesize As Long '接收到的文件大小
Dim strGTFolderPath As String '接收到的文件要存放的文件夹路径(或是磁盘名,如果它存在根目录下的话)
Dim strSDdata As String '用来暂时存放发送的文字类信息.发送时将使用copymemory把它复制到SDdata中
Dim strGTdata As String '用来存放从GTdata中接收到的文字类信息
Dim bytSDdata() As Byte '存文件数据
Dim bytGTdata() As Byte '同上
Dim SDdata() As Byte 'winsock要发送的数据
Dim GTdata() As Byte 'winsock取得到的数据
Dim xuchuan As Boolean '是否继传
Dim filestop As Boolean '是否传输文件
Dim fileover As Boolean '文件是否传完
Dim tmpdata() As Byte '一个数组.用来作临时变量存放
Dim blnSFileing As Boolean '用来判断是否正处于文件发送当中
Dim blnGFileing As Boolean '用来判断是否正处于文件接收当中
Dim blnRdFileOver As Boolean '用来判断文件数据是否已经准备好(为了节约时间一般都在发送过程中把数据准备好而不是在发送完毕后再准备好)
Dim c As Long 'c为发送的数据处于文件的位置
Dim d As Long 'd为接收的数据存放于文件的位置
Dim k As Long '用来作临时变量
'Dim flashcount As Long '用来作闪烁窗口的次数
Dim a As Variant
Dim b As Variant
Private Sub about_Click()
AboutFrm.Show
End Sub
Private Sub chartFrmshow_Click()
Call chart_Click
End Sub
Private Sub gtjindu_Timer()
Dim e As Variant
a = d - a
e = Int(d / (lngGtFilesize / 100))
Label8.Caption = a \ 1024 & " KB/S " & e & "%"
XpPB2.Value = 0
XpPB2.Value = e
a = d
End Sub
Private Sub help_Click()
ShellExecute Me.hwnd, "open", path & "readme.txt", vbNullString, "", 1
End Sub
Private Sub helpbutton_Click()
PopupMenu MainMenu, , helpbutton.Left, helpbutton.Top + helpbutton.Height
End Sub
Private Sub ipaddress_KeyPress(KeyAscii As Integer)
'用回车键代替点击"连接"按钮
If KeyAscii = 13 Then
KeyAscii = 0
Call TCPconnect_Click
End If
End Sub
Private Sub IPinfo_Click()
Start
XMsgBox strIP, , "查看本机IP", ChartFrm.Picture3
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -