bool CXXXXDlg::ConnectFtpServer()
{
m_pInetSession = new CInternetSession( AfxGetAppName() );
if ( NULL == m_pInetSession )
return false; try
{
m_pFtpConnection = m_pInetSession->GetFtpConnection( m_strIP, m_strUserName, m_strPassword, m_iPort, FALSE );
}
catch( CInternetException *pEx )
{
//如果连接失败的话,我会尝试继续再连接10次
//比如,当在连接完第5次失败后,第6次连接成功了,然后退出程序,就会:Microsoft C++ exception: CInternetException at memory location 0x01dffbb0..是内存泄露么?
//如果一开始就连接成功是不会出现这个错误的。
//怎么解决?
pEx->Delete();
DisconnectFtpServer(); return false;
} return true;
}