Dmitriy
April 9th, 1999, 08:49 AM
Hi!
The question 1: Who is responsable for deleting
CFtpConnection after it has been recieved by
CInternetSession::GetFtpConnection?
This function create object CFTPConnection by operator new. But I didn't see in sources MFC operator delete. The help has nothing about this question. In the end of connection I do CFtpConnection::Close() that close connection, but object still in memory. How must it be done?
Question 2: In MSDN library I have article Q164983, explained how I can create async connection with MFC, "by using INTERNET_FLAG_ASYNC in the last parameter of the CInternetSession constructor, dwFlags."(from the
article). But in the constructor I has recieved
ASSERT ! What is the problem?
Here is the constructor from inet.cpp:
CInternetSession::CInternetSession(LPCTSTR pstrAgent /* = NULL */,
DWORD dwContext /* = 1 */,
DWORD dwAccessType /* = PRE_CONFIG_INTERNET_ACCESS */,
LPCTSTR pstrProxyName /* = NULL */,
LPCTSTR pstrProxyBypass /* = NULL */,
DWORD dwFlags /* = 0 */)
{
ASSERT((dwFlags & INTERNET_FLAG_ASYNC) == 0);//HOW CAN I PASS INTERNET_FLAG_ASYNC HERE?
m_bCallbackEnabled = FALSE;
m_pOldCallback = NULL;
m_dwContext = dwContext;
if (pstrAgent == NULL)
pstrAgent = AfxGetAppName();
m_hSession = InternetOpen(pstrAgent, dwAccessType,
pstrProxyName, pstrProxyBypass, dwFlags);
if (m_hSession == NULL)
AfxThrowInternetException(m_dwContext);
else
_afxSessionMap.SetAt(m_hSession, this);
}
The question 1: Who is responsable for deleting
CFtpConnection after it has been recieved by
CInternetSession::GetFtpConnection?
This function create object CFTPConnection by operator new. But I didn't see in sources MFC operator delete. The help has nothing about this question. In the end of connection I do CFtpConnection::Close() that close connection, but object still in memory. How must it be done?
Question 2: In MSDN library I have article Q164983, explained how I can create async connection with MFC, "by using INTERNET_FLAG_ASYNC in the last parameter of the CInternetSession constructor, dwFlags."(from the
article). But in the constructor I has recieved
ASSERT ! What is the problem?
Here is the constructor from inet.cpp:
CInternetSession::CInternetSession(LPCTSTR pstrAgent /* = NULL */,
DWORD dwContext /* = 1 */,
DWORD dwAccessType /* = PRE_CONFIG_INTERNET_ACCESS */,
LPCTSTR pstrProxyName /* = NULL */,
LPCTSTR pstrProxyBypass /* = NULL */,
DWORD dwFlags /* = 0 */)
{
ASSERT((dwFlags & INTERNET_FLAG_ASYNC) == 0);//HOW CAN I PASS INTERNET_FLAG_ASYNC HERE?
m_bCallbackEnabled = FALSE;
m_pOldCallback = NULL;
m_dwContext = dwContext;
if (pstrAgent == NULL)
pstrAgent = AfxGetAppName();
m_hSession = InternetOpen(pstrAgent, dwAccessType,
pstrProxyName, pstrProxyBypass, dwFlags);
if (m_hSession == NULL)
AfxThrowInternetException(m_dwContext);
else
_afxSessionMap.SetAt(m_hSession, this);
}