Click here to Skip to main content
15,896,269 members
Articles / Mobile Apps / Windows Mobile

A File Open Dialog for the PocketPC 2002

Rate me:
Please Sign up or sign in to vote.
4.86/5 (34 votes)
26 Jan 2004CPOL3 min read 291.1K   457   56  
An implementation of a full-browsing file open dialog.
// DateTimeFormat.h: interface for the CDateTimeFormat class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_DATETIMEFORMAT_H__6F7F9D68_B703_4159_9437_5133AAA087B5__INCLUDED_)
#define AFX_DATETIMEFORMAT_H__6F7F9D68_B703_4159_9437_5133AAA087B5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


//! Formats a date and time value
//
class CDateTimeFormat  
{
public:
	CDateTimeFormat();
	virtual ~CDateTimeFormat();

	//! Sets the date time value
	void SetDateTime(COleDateTime &odt);

	//! Sets the format string.
	void SetFormat(LPCTSTR pszFormat);

	//! Sets the format buffer for in-place formatting.
	//! This avoids an eventual CString copy on GetString.
	void SetFormatBuf(LPTSTR pszBuf) {m_pszBuf = pszBuf;}

	//! Returns the formatted string
	LPCTSTR	GetString() {return m_pszBuf;}

protected:
	void	ClearCounters	();
	void	FormatSection	();
	void	FormatDay		();
	void	FormatMonth		();
	void	FormatYear		();
	void	FormatHour		();
	void	FormatAMPM		();
	void	FormatWeek		();
	void	FormatQuarter	();
	void	FormatDigit		(int nDigits, int nValue);

	COleDateTime	m_odt;

	BOOL			m_fValid;		//!< Is the date valid?
	int				m_nd,			//!< Day format
					m_nM,			//!< Month format
					m_ny,			//!< Year format
					m_nw,			//!< Week format
					m_nq,			//!< Quarter format
					m_ng,			//!< Period format
					m_nh,			//!< Hour format (12 hours)
					m_nH,			//!< Hour format (24 hours)
					m_nm,			//!< Minute format
					m_ns,			//!< Seconds format
					m_nt;			//!< Time marker
	TCHAR			m_szRes[256];	//!< Resulting formatted string
	TCHAR*			m_pszBuf;		//!< Pointer to buffer (local or not)
};

#endif // !defined(AFX_DATETIMEFORMAT_H__6F7F9D68_B703_4159_9437_5133AAA087B5__INCLUDED_)

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
Software Developer (Senior) Frotcom International
Portugal Portugal
I work on R&D for Frotcom International, a company that develops web-based fleet management solutions.

Comments and Discussions