设为首页 加入收藏

TOP

分享连接FTP的VC代码
2014-11-23 22:22:23 来源: 作者: 【 】 浏览:8
Tags:分享 连接 FTP 代码

连接FTP的VC代码


CInternetSession* m_pInetSession;
CFtpConnection* m_pFtpConnection;


CString strUserName("name");
CString strPassword("XXXX");
CString strServerName(ftp.XXX.com);
CString strObject("/");


if (m_pFtpConnection != NULL)
m_pFtpConnection->Close();
delete m_pFtpConnection;
m_pFtpConnection = NULL;


CWaitCursor cursor;


try
{
m_pFtpConnection = m_pInetSession->GetFtpConnection(strServerName,strUserName,strPassword);
}
catch (CInternetException* pEx)
{
TCHAR szErr[1024];
if (pEx->GetErrorMessage(szErr, 1024))
AfxMessageBox(szErr, MB_OK);
else
AfxMessageBox(IDS_EXCEPTION, MB_OK);
pEx->Delete();


m_pFtpConnection = NULL;
}


if (m_pFtpConnection != NULL)
{
m_FtpTreeCtl.PopulateTree(m_pFtpConnection, strObject);
}
else
{
m_FtpTreeCtl.PopulateTree();
}


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Ubuntu内核编译详解 下一篇linux内核阅读器的建立

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: