Click here to Skip to main content
15,881,092 members
Articles / Programming Languages / C++
Article

Digital Clock & Timer ActiveX Control

Rate me:
Please Sign up or sign in to vote.
4.43/5 (16 votes)
3 Feb 2002 195.9K   10.3K   58   25
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.

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

 
GeneralMy vote of 5 Pin
hping169-Jan-13 3:29
hping169-Jan-13 3:29 
Generalwindow form refreshing Pin
kirandilip21-Dec-08 22:00
kirandilip21-Dec-08 22:00 
QuestionRUNTIME ERROR Pin
bondhon15-Oct-08 7:41
bondhon15-Oct-08 7:41 
GeneralPublish activeX error! Pin
wahaha_ts15-Feb-06 21:52
wahaha_ts15-Feb-06 21:52 
Generalcompile errors Pin
daveand57-Feb-06 15:37
daveand57-Feb-06 15:37 
Generaldemo source file Pin
davidge7-May-04 20:08
davidge7-May-04 20:08 
GeneralRefresh Problem again Pin
Hing18-Apr-04 22:56
Hing18-Apr-04 22:56 
GeneralRe: Refresh Problem again Pin
lchjxsh10-May-04 23:31
lchjxsh10-May-04 23:31 
GeneralRefreshing Window Pin
Capoeira_Olly12-Jan-04 13:47
Capoeira_Olly12-Jan-04 13:47 
GeneralRe: Refreshing Window Pin
Tzoockee12-Jan-04 20:45
Tzoockee12-Jan-04 20:45 
GeneralRe: Refreshing Window Pin
Capoeira_Olly13-Jan-04 8:21
Capoeira_Olly13-Jan-04 8:21 
GeneralRe: Refreshing Window Pin
Capoeira_Olly13-Jan-04 8:35
Capoeira_Olly13-Jan-04 8:35 
GeneralRe: Refreshing Window Pin
Tzoockee13-Jan-04 21:09
Tzoockee13-Jan-04 21:09 
GeneralRe: Refreshing Window Pin
Tzoockee13-Jan-04 21:09
Tzoockee13-Jan-04 21:09 
QuestionCould I regist this controls as a common controls? Pin
ICE_WIZARD25-Jul-03 6:22
ICE_WIZARD25-Jul-03 6:22 
AnswerRe: Could I regist this controls as a common controls? Pin
Tzoockee1-Aug-03 12:40
Tzoockee1-Aug-03 12:40 
GeneralRe: Could I regist this controls as a common controls? Pin
ICE_WIZARD1-Aug-03 18:32
ICE_WIZARD1-Aug-03 18:32 
GeneralPublishing an activex Pin
Balteo6-Sep-02 8:39
Balteo6-Sep-02 8:39 
GeneralRe: Publishing an activex Pin
Anonymous19-Apr-03 0:55
Anonymous19-Apr-03 0:55 
GeneralRe: Publishing an activex Pin
Tzoockee19-Apr-03 23:26
Tzoockee19-Apr-03 23:26 
GeneralTrouble Starting Timer Pin
15-Apr-02 9:13
suss15-Apr-02 9:13 
GeneralRe: Trouble Starting Timer Pin
devwat19-Jun-04 15:10
devwat19-Jun-04 15:10 
GeneralRe: Trouble Starting Timer Pin
Tzoockee20-Jun-04 20:08
Tzoockee20-Jun-04 20:08 
GeneralFlicker Pin
6-Feb-02 5:55
suss6-Feb-02 5:55 
GeneralRe: Flicker Pin
18-Feb-02 4:27
suss18-Feb-02 4:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.