Component: TFTimer Description: Fast timer component for Delphi16 Author: Richard Shotbolt Email: 100327,2305@compuserve.com Date: 14 Aug 1996 TFTimer is a fast timer component which uses the MMSYSTEM timer routines to achieve an interval down to 1ms instead of the 55ms minimum for TTimer. This control is unusual in that it uses some unconventional techniques with data segments and arrays of event handlers to circumvent the normal requirement for a DLL in this type of control. Because of its somewhat experimental nature I am releasing the source code as freeware in the hope that more experienced programmers than myself can assess it and provide feedback. I am therefore not accepting any responsibility for system crashes or loss of data. Having said that, I have carried out many tests such as creating and destroying on-the-fly, multiple instances and running multiple copies of the same program, alt-tabbing, running other programs etc. under Win3.1 and Win95 and I have not managed to make it fall over. Thanks are due to Immo Wache for the TRtcTimer component which provided some interesting ideas to build on. << Using TFTimer >> TFTimer has the properties, methods and events of TTimer but with some additions and extensions. --------------------------------------------------------------------- << Properties >> --------------------------------------------------------------------- Enabled: Boolean; Starts/stops the timer. Default is True. Interval: Word; Sets the delay in milliseconds. The minimum cannot be set lower than the system is capable of. Most new machines can achieve 1ms, but beware of running out of resources. Default is 1000 (1 sec). Resolution: Word; Sets the accuracy of timing. Smaller values eat up more processor time. Default is 5ms. Countdown: Integer; The timer continues to fire events until Countdown has decremented to zero. You can make it one-shot by setting Countdown to 1. If negative, the timer runs continuously. Default is -1. MaxTime: Word; Read only. Returns the maximum interval that can be set. MinTime: Word; Read only. Returns the minimum interval that can be set. --------------------------------------------------------------------- << Event >> --------------------------------------------------------------------- OnTimer: TNotifyEvent; This is the timer event and is the same as for TTimer --------------------------------------------------------------------- << Installation >> Backup your 'complib.dcl' file as a precaution. Select 'Options', 'Install Components'. Select 'Add', 'Browse'. Select the directory containing the ftcode files. Select 'ftcode.pas' and click OK on each box that appears. The FTimer control will be added to the 'System' section of your component toolbar. If anything goes wrong, restore your backed-up complib.dcl and try again after correcting any obvious problems.