Chapter 14 View contents of this chapter

Introduction

Till now we have been covering event driven programming, where events are triggered as a result of a user action. What if you wanted to take action every few seconds without any user input.

The Timer control enables you to generate responses based on the value of the computer's internal clock. This control keeps track of the time intervals and fires a Timer event whenever a certain amount of time has elapsed.

Play Sound Your computer's clock triggers a timer event 18 times a second.

You can set a preset interval of time after which Windows sends an event message to your application. As with all events, you can write event procedures that execute each time the timer event takes place.

Timers are found everywhere in the real world. The most obvious example is an alarm clock. You set your alarm clock to wake you up at specified time.



© Universal Teacher Publications        INDEX Previous Screen Next Screen