Well... because you asked so nicely!

[pascal]
var Form1: TForm1;
TickResolution : DWORD;
TimeCaps : TTIMECAPS;

implementation

{$R *.dfm}[/pascal]

[pascal]procedure TForm1.FormCreate(Sender: TObject);
Begin
If ( TimeGetDevCaps(@TimeCaps, sizeof(TIMECAPS)) = TIMERR_NOERROR ) Then
Begin
// 1 ms = Accuracy, change the 1 in Max(TimeCaps.wPeriodMin, 1) for a different accuracy!
TickResolution := Min( Max(TimeCaps.wPeriodMin, 1), TimeCaps.wPeriodMax);
TimeBeginPeriod(TickResolution);
End;
end;[/pascal]

[pascal]procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
// Cleanup
TimeEndPeriod(TickResolution);
End;[/pascal]


NOTE: You'll have to include the MMSystem and the Math unit in your application, however you could leave out the math unit and write your own Min/Max function! This example sets the accuracy of the timer to 1 ms, but you could set the accuracy to whatever you want!