MFC Progress bar for status of FTP upload
Posted on 2005-03-16
I have code in place to upload a file with ftp and I want to advance a progress bar to show the status of the upload.
I have added a progress Control to my dialog and associated a CProgressCtrl member variable with it.
The code is as follows:
HINTERNET m_hInetHandle = InternetOpen ( "FTP Backup", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 );
HINTERNET m_hFtpHandle = InternetConnectA (m_hInetHandle, (LPCSTR) szUrl, INTERNET_DEFAULT_FTP_PORT, (LPCSTR) szUser, (LPCSTR) szPW, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0) ;
int rv = FtpPutFileA ( m_hFtpHandle, (LPCSTR) szSource, (LPCSTR) szDest, FTP_TRANSFER_TYPE_UNKNOWN, 0 );
if ( m_hFtpHandle )
InternetCloseHandle ( m_hFtpHandle ) ;
if ( m_hInetHandle )
InternetCloseHandle ( m_hInetHandle ) ;
The name of the progCtrl is m_Progress.