#include "afxinet.h"
CInternetSession* m_pInetSession;
CFtpConnection* m_pFtpConnection;
m_pInetSession = new CInternetSession(AfxGetAppName(),1,PRE_CONFIG_INTERNET_ACCESS);
try
{
CString addr,uid,pass;
GetDlgItemText(IDC_EDIT11,addr);
GetDlgItemText(IDC_EDIT5,uid);
GetDlgItemText(IDC_EDIT4,pass);
m_pFtpConnection = m_pInetSession->GetFtpConnection(addr,uid,pass,21);
m_pFtpConnection->Command("CWD /download/excel服务器安装程序/V8.6/091123");
}
catch(CInternetException *pEx)
{
TCHAR szError[1024];
if(pEx->GetErrorMessage(szError,1024))
AfxMessageBox(szError);
else
AfxMessageBox("There was an exception");
pEx->Delete();
m_pFtpConnection=NULL;
}
m_pFtpConnection->GetFile("ExcelServer2008EE_client.exe","d://ExcelServer2008EE_client.exe",TRUE,FILE_ATTRIBUTE_NORMAL,FTP_TRANSFER_TYPE_BINARY,1);
AfxMessageBox("download sucessfull");
m_pInetSession->Close();