Click here to Skip to main content
15,897,518 members
Articles / Programming Languages / C++

Digital Clock & Timer ActiveX Control

Rate me:
Please Sign up or sign in to vote.
4.43/5 (16 votes)
3 Feb 2002 196.1K   10.3K   58  
This is an ActiveX control that can be used as a digital clock, or as a timer.
#if !defined(AFX_DTIMERCTL_H__C0F8D534_E412_11D5_9724_0048545319BF__INCLUDED_)
#define AFX_DTIMERCTL_H__C0F8D534_E412_11D5_9724_0048545319BF__INCLUDED_

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

// DTimerCtl.h : Declaration of the CDTimerCtrl ActiveX Control class.

/////////////////////////////////////////////////////////////////////////////
// CDTimerCtrl : See DTimerCtl.cpp for implementation.

#include "cifre.h"

class CDTimerCtrl : public COleControl
{
	DECLARE_DYNCREATE(CDTimerCtrl)

// Constructor
public:
	CDTimerCtrl();
	OLE_COLOR m_backcolor;
	OLE_COLOR m_textcolor;
	OLE_COLOR m_linecolor;
	CCifre cc;
	CRect rect;
	short this_mode;
	short minute;
	short hour;
	short second;

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDTimerCtrl)
	public:
	virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
	virtual void DoPropExchange(CPropExchange* pPX);
	virtual void OnResetState();
	//}}AFX_VIRTUAL

// Implementation
protected:
	~CDTimerCtrl();

	DECLARE_OLECREATE_EX(CDTimerCtrl)    // Class factory and guid
	DECLARE_OLETYPELIB(CDTimerCtrl)      // GetTypeInfo
	DECLARE_PROPPAGEIDS(CDTimerCtrl)     // Property page IDs
	DECLARE_OLECTLTYPE(CDTimerCtrl)		// Type name and misc status

// Message maps
	//{{AFX_MSG(CDTimerCtrl)
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

// Dispatch maps
	//{{AFX_DISPATCH(CDTimerCtrl)
	afx_msg void SetColors(OLE_COLOR back, OLE_COLOR line, OLE_COLOR text);
	afx_msg void SetMode(short mode);
	afx_msg void SetTime(short hou, short min, short sec);
	//}}AFX_DISPATCH
	DECLARE_DISPATCH_MAP()

	afx_msg void AboutBox();

// Event maps
	//{{AFX_EVENT(CDTimerCtrl)
	//}}AFX_EVENT
	DECLARE_EVENT_MAP()

// Dispatch and event IDs
public:
	enum {
	//{{AFX_DISP_ID(CDTimerCtrl)
	dispidSetColors = 1L,
	dispidSetMode = 2L,
	dispidSetTime = 3L,
	//}}AFX_DISP_ID
	};
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DTIMERCTL_H__C0F8D534_E412_11D5_9724_0048545319BF__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 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


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

Comments and Discussions