Vijay Kumar C
April 8th, 1999, 03:55 AM
Hi EveryOne,
I am using the CinternetSession to write a small FTP Client.
I need to know status on line using "OnStatusCallback". How do I implement this.
The code I'm working is:
void CFtpConsole::OnConnect()
{
// TODO: Add your control notification handler code here
if (m_pFtpConnection != NULL)
m_pFtpConnection->Close();
delete m_pFtpConnection;
m_pFtpConnection = NULL;
UpdateData(TRUE);
try
{
EnableStatusCallback(TRUE);
}
catch (CInternetException* pEx)
{
// catch errors from WinINet
TCHAR szErr[1024];
if (pEx->GetErrorMessage(szErr, 1024))
AfxMessageBox(szErr, MB_OK);
else
//AfxMessageBox(IDS_EXCEPTION, MB_OK);
AfxMessageBox("Unknown Exception", MB_OK);
pEx->Delete();
m_pFtpConnection = NULL;
}
// Connecting to the Server
try
{ // I want to give status here1...
m_pInetSession->GetFtpConnection(m_Server,m_UserName,m_PassWord,21,FALSE );
}
catch (CInternetException* pEx)
{
// catch errors from WinINet
TCHAR szErr[1024];
if (pEx->GetErrorMessage(szErr, 1024))
AfxMessageBox(szErr, MB_OK);
else
//AfxMessageBox(IDS_EXCEPTION, MB_OK);
AfxMessageBox("Unknown Exception", MB_OK);
pEx->Delete();
m_pFtpConnection = NULL;
}
// PopulateTree() will display an error if the FTP connection
// could not be made, otherwise, it grabs the root listing
// and expands any folder indicated by the site name
if (m_pFtpConnection != NULL)
{
//m_FtpTreeCtl.PopulateTree(m_pFtpConnection, strObject);
m_FtpTreeCtl.PopulateTree(m_pFtpConnection, "c2001");
}
else
{
m_FtpTreeCtl.PopulateTree();
}
}
Do I need to call OnStatusCallBack evertime I need status. I don't understand how it is used.
Warm Regards,
Vijay
I am using the CinternetSession to write a small FTP Client.
I need to know status on line using "OnStatusCallback". How do I implement this.
The code I'm working is:
void CFtpConsole::OnConnect()
{
// TODO: Add your control notification handler code here
if (m_pFtpConnection != NULL)
m_pFtpConnection->Close();
delete m_pFtpConnection;
m_pFtpConnection = NULL;
UpdateData(TRUE);
try
{
EnableStatusCallback(TRUE);
}
catch (CInternetException* pEx)
{
// catch errors from WinINet
TCHAR szErr[1024];
if (pEx->GetErrorMessage(szErr, 1024))
AfxMessageBox(szErr, MB_OK);
else
//AfxMessageBox(IDS_EXCEPTION, MB_OK);
AfxMessageBox("Unknown Exception", MB_OK);
pEx->Delete();
m_pFtpConnection = NULL;
}
// Connecting to the Server
try
{ // I want to give status here1...
m_pInetSession->GetFtpConnection(m_Server,m_UserName,m_PassWord,21,FALSE );
}
catch (CInternetException* pEx)
{
// catch errors from WinINet
TCHAR szErr[1024];
if (pEx->GetErrorMessage(szErr, 1024))
AfxMessageBox(szErr, MB_OK);
else
//AfxMessageBox(IDS_EXCEPTION, MB_OK);
AfxMessageBox("Unknown Exception", MB_OK);
pEx->Delete();
m_pFtpConnection = NULL;
}
// PopulateTree() will display an error if the FTP connection
// could not be made, otherwise, it grabs the root listing
// and expands any folder indicated by the site name
if (m_pFtpConnection != NULL)
{
//m_FtpTreeCtl.PopulateTree(m_pFtpConnection, strObject);
m_FtpTreeCtl.PopulateTree(m_pFtpConnection, "c2001");
}
else
{
m_FtpTreeCtl.PopulateTree();
}
}
Do I need to call OnStatusCallBack evertime I need status. I don't understand how it is used.
Warm Regards,
Vijay