Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

A Complete FTP Server

, 30 May 2005
This article presents a fully functional implementation of a FTP server.
/****************************************************************/
/*																*/
/*  StatisticsPage.cpp											*/
/*																*/
/*  Implementation of the CStatisticsPage class.				*/
/*	This class is a part of Quick 'n Easy FTP Server.			*/
/*																*/
/*  Programmed by Pablo van der Meer							*/
/*  Copyright Pablo Software Solutions 2005						*/
/*	http://www.pablosoftwaresolutions.com						*/
/*																*/
/*  Last updated: May 28, 2005									*/
/*																*/
/****************************************************************/


#include "stdafx.h"
#include "ftpserver.h"
#include "StatisticsPage.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


CStatisticsPage::CStatisticsPage() : CDialogResize(CStatisticsPage::IDD)
{
	//{{AFX_DATA_INIT(CStatisticsPage)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CStatisticsPage::DoDataExchange(CDataExchange* pDX)
{
	CDialogResize::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CStatisticsPage)
	DDX_Control(pDX, IDC_STATISTICS, m_StatisticsCtrl);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CStatisticsPage, CDialogResize)
	//{{AFX_MSG_MAP(CStatisticsPage)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


BEGIN_DLGRESIZE_MAP(CStatisticsPage)
	DLGRESIZE_CONTROL(IDC_STATISTICS, DLSZ_SIZE_X | DLSZ_SIZE_Y)
END_DLGRESIZE_MAP()


/********************************************************************/
/*																	*/
/* Function name : OnInitDialog										*/
/* Description   : Called by the framework in response to the		*/
/*				   WM_INITDIALOG message.							*/
/*																	*/
/********************************************************************/
BOOL CStatisticsPage::OnInitDialog() 
{
	CDialogResize::OnInitDialog();
	
	InitResizing(FALSE, FALSE, WS_CLIPCHILDREN);
	
	m_StatisticsCtrl.InsertColumn(0, "Statistic");		
	m_StatisticsCtrl.InsertColumn(1, "Value");	

	m_StatisticsCtrl.InsertItem(0, "Total Connections");
	m_StatisticsCtrl.SetItemText(0, 1, "0");
	m_StatisticsCtrl.InsertItem(1, "Current Connections");
	m_StatisticsCtrl.SetItemText(1, 1, "0");
	m_StatisticsCtrl.InsertItem(2, "Files Downloaded");
	m_StatisticsCtrl.SetItemText(2, 1, "0");
	m_StatisticsCtrl.InsertItem(3, "Files Uploaded");
	m_StatisticsCtrl.SetItemText(3, 1, "0");
	m_StatisticsCtrl.InsertItem(4, "Failed Downloads");
	m_StatisticsCtrl.SetItemText(4, 1, "0");
	m_StatisticsCtrl.InsertItem(5, "Failed Uploads");
	m_StatisticsCtrl.SetItemText(5, 1, "0");
	m_StatisticsCtrl.InsertItem(6, "Total kilobytes received");
	m_StatisticsCtrl.SetItemText(6, 1, "0");
	m_StatisticsCtrl.InsertItem(7, "Total kilobytes sent");
	m_StatisticsCtrl.SetItemText(7, 1, "0");
	
	DWORD dwStyle = m_StatisticsCtrl.GetExtendedStyle();
	dwStyle |= LVS_EX_FULLROWSELECT;
    m_StatisticsCtrl.SetExtendedStyle(dwStyle);

	AutoSizeColumns(&m_StatisticsCtrl);
	return TRUE;
}


/********************************************************************/
/*																	*/
/* Function name : SetValue											*/
/* Description   : Set statistics value								*/
/*																	*/
/********************************************************************/
void CStatisticsPage::SetValue(int nType, int nValue)
{
	CString strValue;
	strValue.Format("%d", nValue);
	m_StatisticsCtrl.SetItemText(nType, 1, strValue);
}


/********************************************************************/
/*																	*/
/* Function name : SetValue											*/
/* Description   : Set statistics value								*/
/*																	*/
/********************************************************************/
void CStatisticsPage::SetValue(int nType, LPCTSTR lpszValue)
{
	m_StatisticsCtrl.SetItemText(nType, 1, lpszValue);
}


/********************************************************************/
/*																	*/
/* Function name : OnOK												*/
/* Description   : Do not close when ENTER-key is pressed			*/
/*																	*/
/********************************************************************/
void CStatisticsPage::OnOK() 
{
//	CDialogResize::OnOK();
}


/********************************************************************/
/*																	*/
/* Function name : OnCancel											*/
/* Description   : Do not close when ESC-key is pressed				*/
/*																	*/
/********************************************************************/
void CStatisticsPage::OnCancel() 
{
//	CDialogResize::OnCancel();
}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Pablo van der Meer
Web Developer
Netherlands Netherlands
No Biography provided

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 30 May 2005
Article Copyright 2002 by Pablo van der Meer
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid