tags:

views:

19

answers:

1

Hello guys, I would like to implement a stop watch as part of my system. i want it to have a simple feture that when pressing start the timer runs and when pressing stop it stops.

how should i do such a thing(timer func + graphical presentation)? *when googling i came across many things that were not suitable.

Tnx

A: 

Implementing a digital countdown is the easiest thing to do - Text field, Button, and a Timer. Implementing a graphical stopwatch is the hardest, you will need a bitmap for the watch face, then you can draw the hands on it. How much time do you want spend writing the code, versus how good should it look?

The basics are like this:

  1. In OnInitDialog, add SetTimer(ID_MY_STOPWATCH,1000,NULL)
  2. In your message map you need ON_WM_TIMER()
  3. Then a WM_TIMER handler like this:

    void CTimerTestDlg::OnTimer(UINT_PTR nIDEvent) {

    // TODO: Add your message handler code here and/or call default

    if (nIDEvent==ID_MY_STOPWATCH) { // Update the UI here }

    CDialog::OnTimer(nIDEvent); }

Jeff
Well tnx.but i'm new for mfc. how can i use the timer option?
TaAt