΢ͻӦ
MICROCOMPUTER & ITS APPLICATIONS
2000Vol.19No.6P.16-17




VBֶ֧ϵInternetؼ
Сܵ
ժҪFTPĹܡʵַFTPʵֶϵԭVisual Basic̽˴ֶ֧ϵInternetؼĹ̡
ؼʣϵ Microsoft Internet Transferؼ ActiveXؼ Visual Basic
InternetռFTPļݡͨõص㣬ԽԽƵʹáȻкܶʵõֳɳãûϣԼƺͶƾFTPܵӦáVBMicrosoft Internet TransferؼΪ߹ΪʹõĹ֮һûԴΪɿԼ֧ļӦáVBȴֶ֧ϵĿؼֶ֧ϵInternetؼԱοʹá
1  FTPϵԭ
FTP(ļЭ)Internetʹ㷺Э֮һʹFTPЭFTPϵ¼ʵļϡءFTPһпͻṹϵͳϵͳɿͻͷϵ2ɡFTPЭڲһɹûʹõļĴͣ磺лĿ¼CDȡļGETļPUTȡļʵʵϾǿͻͷϵFTPЭ໥ͨ(Ӧ)ĽУ˽еFTPϽе¼֤ûݡ
FTPһʵֵģFTP£
CD file1 ıĿ¼ı䵽file1ָĿ¼
CDUP ı䵽Ŀ¼ЧڡCD..
CLOSE رյǰFTPӡ
DELETE file1 ɾfile1ָļ
DIR file1 Ŀ¼file1ָĿ¼ͨ
ҪʹԶ﷨û
ָfile1صǰĿ¼
GET file1 file2 file1ָԶļ
file2ָ±ļ
LS file1 бfile1ָĿ¼ͨ
ҪʹԶ﷨
MKDIR file1   Ŀ¼file1ָĿ¼
ǷɹȡûԶϵȨޡ
PUT file1 file2 file1ָıļfile2
ָԶϡ
PWD ӡĿ¼صǰĿ¼
QUIT ֹǰû
RECV file1 file2file1ָԶļ
file2ָıļЧGET
RENAME file1 file2file1Զļ
Ϊfile2ָƣɹ
ȡûԶϵȨޡ
RMDIR file1ɾĿ¼ɾfile1ָԶ
Ŀ¼ɹȡûԶϵȨޡ
SEND file1 file2file1ָıļ
file2ָԶϣЧPUT
SIZE file1 file1ָĿ¼С
ЩУԶϻȡļõGET⣬2õFTPδ룬RESTARTREGET
RESTARTĹûʹGETԶļʹPUTԶļ;·⣬жʱRESTARTϵͳһGETPUTʱϴαжϴ¿ʼϡأӶʹûشͷʼԼļʱ䡣
REGETĹûʹGETԶļĹзжʱʹREGETʵִжϴ¿ʼļ䡣
2·ߡʲȶļϴʱԵʮãԽƳֶ֧ϵӦáҪעǣFTPĻʵֵܴ󣬸FTPϵͳֵ֧ҲͬRESTARTREGETʵֽϵͳ֧֣ϵܷʵֻҪԷǷ֧֡򣬼Ҳܹʵֶϵ
2  ֶ֧ϵĿؼ
2.1 ؼܵĹ滮
1ֶ֧ϵĿؼӦµĻܣ
1STARTCANCELPAUSESTARTʾʼжϺ䣻CANCELʾжϴ䣻PAUSEʾ̣ͣSTARTٴλָ䡣
2ԣURLԣʾԶλãFPOSԣʾļԶϵĿ¼λãDIRԣʾļڱػϵ·ļRunCodeԣʾڽļ״̬
3¼ɴ֪ͨ¼ȡ
2.2 ؼ
1VB½1ActiceXؼ̣ؼ̵Ĺã磺ddxc
2ڱʾUserControl1Formӽһ
Microsoft Internet TransferؼĬΪInet1
3VBġӳ򡱲˵ѡӳ򿪡ӳڣڡӳбѡVB 6 ActiveXؼӿ򵼡ͬʱڴ½ǽмء͡أжءĸѡѡУȷ
4VBġӳ򡱲˵ѡӳ򿪡ActiveXؼӿ򵼡ڣڡActiveXؼӿ򵼡ܡѡһ롰ѡӿڳԱڣκβֱѡһ롰ԶӿڳԱڣ¡½ťµĽӿڳԱԶĹӽȥʾֱɡ
5ʱFormĴ봰ڣԿвִ뱻ӽԱͷидĴժ¼(б岿дӵĴ룬ಿ֤ѡΪÿؼӳԱʱϵͳӵġ)
Ա
Dim mfpos As String
Dim murl As String
Dim mdir As String
Dim mruncode As Integer
ע⣡Ҫɾ޸бע͵У
MemberInfo14
Public Function start() As Variant
Dim comstr As String
If mruncode2 Then
mruncode2ʾĳ䴦ڱж״̬
comstrrestart   restartлָ䡣
Inet1.Execute urlcomstr
End If
comstrget  士mfpos 士mdir ôĲ
Inet1.Execute murlcomstr   俪ʼд
mruncode0 mruncode 0 ʾڽд
End Function
ע⣡Ҫɾ޸бע͵У
MemberInfo14
Public Function cancel() As Variant
Dim comstr As String
comstrclose
Inet1.Execute murlcomstr   ֹǰFTP
mruncode1  Ϊ־ֵ
End Function
ע⣡Ҫɾ޸бע͵У
MemberInfo14
Public Function pause As Variant
Dim comstr As String
comstrclose
Inet1.Execute murlcomstr   ֹǰFTP
mruncode2  Ϊ־ֵ
End Function
Private Sub Inet1StateChanged(ByVal State As Integer)
Inetؼķ״̬Ϊ־ֵ
Dim comstr As String
Select Case State
Case icError䴫䷢˴ж׼
¿ʼ
comstrclose
Inet1.Execute murlcomstr   ֹǰFTP
1ֵֵµ1ӡ
comstrrestart   restartлָ䡣
Inet1.Execute urlcomstr
comstrget士mfpos 士mdir  ôĲ
Inet1.Execute murlcomstr   俪ʼд
Case icResponseCompleted   䴫ɹ
comstrclose
Inet1.Execute murlcomstr   ֹǰFTP
mruncode1  Ϊ־ֵ
End Select
End Sub
6ɺ󣬶б롢ɣɹáӦóͨڳвԸÿؼRunCodeֹͣ
ֻ˸ÿؼıƹ̣ʵ˻ĶϵܡҪΪʽʹãдһơ
СϺͬôѧϵ200092
ܵϺͬôѧϵ200092
ο
1Peroutsos E.ʹVisual Basic 5 ActiveX.йˮˮ磬1998
ոڣ19991220
