Thanks for your effort! but ....

Well I added the code, unfortunately it is still skipping ~15 ms on my Win XP. I added a button that checks the gettickcount until 50ms passed. and gettickcount ends with 63 instead of 50.

Maybe I am doing something wrong :/

[pascal]

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, MMSystem , math, StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
end;

var
Form1: TForm1;
TickResolution : DWORD;
TimeCaps : TTIMECAPS;
i,number:integer;

implementation

{$R *.dfm}

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
TimeEndPeriod(TickResolution);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
If ( TimeGetDevCaps(@TimeCaps, sizeof(TIMECAPS)) = TIMERR_NOERROR ) Then
Begin

TickResolution := Min( Max(TimeCaps.wPeriodMin, 1), TimeCaps.wPeriodMax);
TimeBeginPeriod(TickResolution);
End;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
i:=gettickcount;
while i+50 > gettickcount do begin
number:=gettickcount-i;
end;
showmessage(inttostr(number));
end;

end.

[/pascal]

edit: btw the comparison in oncreate procedure does return TIMERR_NOERROR, so thats not the problem