SimpleTimer, ver. 1.0.3

[Properties] [Methods] [Events]
[How To Use] [Known Bugs] [Comments]

SimpleTimer is a timer class. It has the same timer resolution as TTimer, but it is more lightweight because it's derived from TObject in stead of TComponent. Furthermore, the same handle is shared between multiple instances of SimpleTimer. This makes it ideal for developers who need a timer in their own components or applications, but want to keep the resource usage minimal.

Properties

Owner property Owner: TComponent;
The owner of the timer.
Read-only
Active property Active: Boolean;
Whether the timer is running.
Read-only

Methods

Create type TSimpleTimerCallBackProc = procedure(AOwner: TComponent); stdcall;
constructor (AOwner: TComponent; CallBackProc: TSimpleTimerCallBackProc);

Creates a new TSimpleTimer instance. You need to declare a procedure of type TSimpleTimerCallBackProc which will be called continuously at the interval you specify in the Start method.
NOTE: Be sure to declare the stdcall directive, as is normal practice with callback methods.
NOTE: The callback method cannot be part of any class. It must be a simple method.
Returns new TSimpleTimer object
Start function Start(MilliSecs: Cardinal): Boolean;
Starts the timer, using the specified interval in millisecs. If the timer is already running it will be stopped, then restarted with the new interval.
NOTE: If the method returns false it means the system has run out of timer resources. That's bad.
Returns true or false
Stop function Stop: Boolean;
Stops the timer.
Returns true or false

Events

How To Use

Known Bugs

Comments

SimpleTimer is freeware. Feel free to use and improve it, but please include all original files if you redistribute the zip-file. If you have any comments or corrections I would very much like to hear them.

Get the latest version from http://www3.brinkster.com/troels/delphi.asp.

Troels Jakobsen
delphiuser@get2net.dk