# 有个不正当的方法

Posted by Honey on August 21, 1999 at 22:57:05:

In Reply to: cww站上的程式呼叫拨号网路试了好久皆无法work? posted by Raymond on August 21, 1999 at 20:34:53:

如果用InternetConnect开启ftp
电脑会自动连线 试试以下程式
在表单上放上一个command

Option Explicit
Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" _
(ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, _
ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
Private Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" _
(ByVal hInternetSession As Long, ByVal sServerName As String, ByVal nServerPort As Integer, _
ByVal sUsername As String, ByVal sPassword As String, ByVal lService As Long, _
ByVal lFlags As Long, ByVal lContext As Long) As Long
Private Const INTERNET_OPEN_TYPE_PROXY = 3
Private Const INTERNET_INVALID_PORT_NUMBER = 0
Private Const INTERNET_SERVICE_FTP = 1
Private Const INTERNET_DEFAULT_FTP_PORT = 21
Private Const INTERNET_FLAG_PASSIVE = &H8000000
Private Sub Command1_Click()
Dim hOpen As Long, StrP As String
StrP = CStr(INTERNET_DEFAULT_FTP_PORT)
hOpen = InternetOpen("Honey", INTERNET_OPEN_TYPE_PROXY, StrP, vbNullString, 0)

InternetConnect hOpen, "Honey", _
INTERNET_INVALID_PORT_NUMBER, _
"Honey", "Honey", INTERNET_SERVICE_FTP, _
INTERNET_FLAG_PASSIVE, 0
End Sub

Follow Ups:

- Re: 谢谢两位，我找到其它的方法了! Raymond 14:49:44 8/22/99 (0)