📄 fmvbftpjr.frm
字号:
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form frmFTPst
Caption = "FTP客户端程序"
ClientHeight = 1650
ClientLeft = 60
ClientTop = 345
ClientWidth = 5265
LinkTopic = "Form1"
ScaleHeight = 1650
ScaleWidth = 5265
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Caption = "代理服务器"
Height = 1350
Left = 2520
TabIndex = 3
Top = 135
Width = 2685
Begin VB.TextBox txtProxyPort
Appearance = 0 'Flat
Enabled = 0 'False
Height = 300
Left = 675
TabIndex = 7
Top = 735
Width = 840
End
Begin VB.TextBox txtProxy
Appearance = 0 'Flat
Enabled = 0 'False
Height = 285
Left = 660
TabIndex = 4
Top = 240
Width = 1905
End
Begin VB.Label Label5
Caption = "端口:"
Height = 300
Left = 120
TabIndex = 6
Top = 780
Width = 585
End
Begin VB.Label Label1
Caption = "地址:"
Height = 285
Left = 120
TabIndex = 5
Top = 300
Width = 570
End
End
Begin VB.Frame Frame1
Caption = "打开及关闭会话"
Height = 1365
Left = 180
TabIndex = 0
Top = 165
Width = 2175
Begin VB.CommandButton cmdInternetOpen
Caption = "打开Internet会话"
Height = 330
Left = 315
TabIndex = 2
Top = 330
Width = 1665
End
Begin VB.CommandButton cmdClosehOpen
Caption = "关闭Internet会话"
Height = 330
Left = 315
TabIndex = 1
Top = 780
Width = 1665
End
End
Begin ComctlLib.ImageList ImageList1
Left = 2520
Top = 6300
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
MaskColor = 12632256
_Version = 327682
End
End
Attribute VB_Name = "frmFTPst"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
bActiveSession = False
hOpen = 0
hConnection = 0
cmdClosehOpen.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
cmdClosehOpen_Click
End Sub
Private Sub cmdInternetOpen_Click()
'在建立一定类型的Internet连接前,必须首先建立Internet对话,如果成功建立
'Internet对话,则返回一个句柄作为建立相应类型的连接(在这里是FTP连接)
'InternetConnect()的参数
If Len(txtProxy.Text) <> 0 Then
hOpen = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_PROXY, txtProxy.Text, vbNullString, 0)
Else
hOpen = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, 0)
End If
'打开internet连接的线程后,根据打开的结果设置各个按扭的状态
If hOpen = 0 Then
MsgBox "不能打开Internet连接", vbCritical
cmdInternetOpen.Enabled = False
cmdClosehOpen.Enabled = True
Else
frmFTPst.cmdClosehOpen.Enabled = True
frmFTPst.cmdInternetOpen.Enabled = False
'如果打开成功,以模式对话框显示主窗体frmFTP2
frmFTP2.Show vbModal
End If
End Sub
Private Sub cmdClosehOpen_Click()
'关闭连接,将所有的Internet连接的句柄关闭
'清除所有的对象集合和窗体中的文本框的内容
If hConnection <> 0 Then
InternetCloseHandle (hConnection)
End If
If hOpen <> 0 Then
InternetCloseHandle (hOpen)
End If
hConnection = 0
hOpen = 0
bActiveSession = False
cmdInternetOpen.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -