本帖最后由 qwe88 于 23-12-2009 02:47 PM 编辑
我在尝试用vb connect 去自己的ftpcode 如下:
- Public Class Form1
- 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 Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" _ (ByVal hFtpSession As Long, ByVal lpszRemoteFile As String, _ ByVal lpszNewFile As String, ByVal fFailIfExists As Boolean, _ ByVal dwFlagsAndAttributes As Long, ByVal dwFlags As Long, _ ByVal dwContext As Long) As Boolean
- Private Declare Function InternetCloseHandle _ Lib "wininet.dll" (ByVal hInet As Long) As Integer
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim lngINet& = InternetOpen("MyFTP Control", 1, vbNullString, vbNullString, 0) Dim lngINetConn& = InternetConnect(lngINet, "localhost", 21, "chitak", "nasilemak", 1, 0, 0) End SubEnd Class
复制代码
不过run过后有个很奇怪的error 出现在在那段highlight的地方 :
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
有那位大大可以告诉我那里做错吗?
谢谢~
|