首先,建立一个mfc 规则dll,写了个接口
extern "C"_declspec(dllexport) bool GetFtpFile(CString strServer,
int iPort,
CString strUser,
CString strPassword,
CString strFtpFileName,
CString strLocalFileName)
{ CInternetSession ses; CFtpConnection* pFTP=ses.GetFtpConnection(strServer,
strUser,strPassword,iPort,FALSE); if (pFTP->GetFile(strFtpFileName,strLocalFileName,0,128,2,1)==0)
{
return false; }
else
{
return true;
}然后,在vb中调用,
Public Declare Function GetFtpFile Lib "mfcftpdll.dll" (ByVal server As String, ByVal port As Integer, _
ByVal user As String, ByVal password As String, ByVal ftpfile As String, ByVal localfile As String) As Boolean
If GetFtpFile("192.168.0.2", 21, "11", "123", "36.Tif", App.Path & "\11.tif") = True Then
MsgBox "成功"
Else
MsgBox "失败"
End If运行时提示严重错误。怎么回事,请大家指教。
extern "C"_declspec(dllexport) bool GetFtpFile(CString strServer,
int iPort,
CString strUser,
CString strPassword,
CString strFtpFileName,
CString strLocalFileName)
{ CInternetSession ses; CFtpConnection* pFTP=ses.GetFtpConnection(strServer,
strUser,strPassword,iPort,FALSE); if (pFTP->GetFile(strFtpFileName,strLocalFileName,0,128,2,1)==0)
{
return false; }
else
{
return true;
}然后,在vb中调用,
Public Declare Function GetFtpFile Lib "mfcftpdll.dll" (ByVal server As String, ByVal port As Integer, _
ByVal user As String, ByVal password As String, ByVal ftpfile As String, ByVal localfile As String) As Boolean
If GetFtpFile("192.168.0.2", 21, "11", "123", "36.Tif", App.Path & "\11.tif") = True Then
MsgBox "成功"
Else
MsgBox "失败"
End If运行时提示严重错误。怎么回事,请大家指教。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货