|
#include "stdafx.h"
#include "ftpTransDlg.h"
#include "ftpViewRes.h"
CeFtpTransferDlg::CeFtpTransferDlg(CeFtpClient* pClient, LPCTSTR lpszSrc, LPCTSTR lpszDest, DWORD dwSize, bool bPut) :
CeDialog(IDD_TRANSFER),
m_thread(pClient, lpszSrc, lpszDest, dwSize, bPut)
{
m_pClient = pClient;
}
CeFtpTransferDlg::~CeFtpTransferDlg()
{
}
BOOL CeFtpTransferDlg::OnInitDialog()
{
BOOL bRet = CeDialog::OnInitDialog();
HWND h = GetDlgItem(IDC_PROGRESS);
ProgressCtrl_SetRange(h, 0, 100);
m_pClient->SetCallbackHandle(m_hWnd);
SetDlgItemText(IDC_STATIC_FILENAME, m_thread.m_lpszSrc);
m_thread.m_hWndMsg = m_hWnd;
m_thread.Start();
return bRet;
}
void CeFtpTransferDlg::OnCancel()
{
if (! m_thread.IsRunning())
CeDialog::OnCancel();
//else
// Cancel is not handled properly yet in the dowmload code
// m_pClient->CancelTransfer();
}
void CeFtpTransferDlg::OnOK()
{
if (! m_thread.IsRunning())
CeDialog::OnOK();
}
LRESULT CeFtpTransferDlg::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled)
{
if (WM_FTP_CALLBACK == uMsg)
{
HWND h = GetDlgItem(IDC_PROGRESS);
ProgressCtrl_SetPos(h, (wParam * 100) / lParam);
bHandled = true;
}
else if (WM_WORKER_DONE == uMsg)
{
// wait to finish, should be done shortly
m_thread.MsgWaitFor();
// close the dialog, we completed
OnOK();
bHandled = true;
}
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.