65.9K
CodeProject is changing. Read more.
Home

Digital Clock & Timer ActiveX Control

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.43/5 (15 votes)

Feb 4, 2002

viewsIcon

197825

downloadIcon

10316

This is an ActiveX control that can be used as a digital clock, or as a timer.

Sample Image - DTimer.gif

Introduction

This is an ActiveX control developed in Visual C++ 6.0. It can be used as a digital clock, or as a timer. To use, simply add to your project, put it on a form, and associate it with a class member using the Class Wizard. You can customize it using the following methods:

  • void CDTimer::SetColors(OLE_COLOR back, OLE_COLOR line, OLE_COLOR text)

    To set the color appearance.

  • void CDTimer::SetMode(short mode)

    To set it as a clock or a timer.

  • void CDTimer::SetTime(short hou, short min, short sec)

    To display a specific time.

Examples:

m_timer.SetColors(RGB(0,0,0),RGB(0,0,0),RGB(255,0,0));
//display red numbers on black background

m_timer.SetMode(0);
// 0 for digital clock, 1 for custom timer.

m_timer.SetTimer(20,8,45);
//set the time to 20:08:45

When setting it as a custom timer, you must start a timer in which you update the time by calling the SetTime member function.