Click here to Skip to main content
15,884,018 members
Articles / Web Development / HTML

A Comprehensive CE Class Library to Replace ATL and MFC

Rate me:
Please Sign up or sign in to vote.
4.48/5 (14 votes)
4 Oct 2000CPOL 278.3K   998   70  
A collection of classes for CE that do not use ATL or MFC, plus an FTP client, database viewer, and sample application that solves beam deflection equations.
#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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions