You do alot of processing of distance, and this also may have some effect (I doubt it if your machine is faster than 2 Gig Hertz), , , So there may not be a cure for your problem, at least I do not know of one.

Also you are trying to get the millimeter movement, but your method WILL NOT WORK, , you are using the getdevicecaps(screen,HORZS

type

PHookRec = ^THookRec;

THookRec = packed Record

KeyCount, LeftBCount, RightBCount, MiddleBCount,

MouseDistance: Cardinal;

LastMPt: TPoint;

function MouseHookFunc(Code, wParam: Integer; var MouseStrut: TMOUSEHOOKSTRUCT): Integer; stdcall;

var

dist1: Cardinal;

begin

Result := CallNextHookEx(0, Code, wParam, Integer(@MouseStrut));

if (Code < 0) or IsBadCodePtr(PHookRec1) then Exit;

if (Code = HC_ACTION)then

begin

if wParam = WM_LBUTTONUP then

if PHookRec1.LeftBCount < MAXDWORD then // do not go over range

Inc(PHookRec1.LeftBCount);

if wParam = WM_RBUTTONUP then

if PHookRec1.RightBCount < MAXDWORD then // do not go over range

Inc(PHookRec1.RightBCount)

if wParam = WM_MBUTTONUP then

if PHookRec1.MiddleBCount < MAXDWORD then // do not go over range

Inc(PHookRec1.MiddleBCount

if wParam = WM_MOUSEMOVE then

begin

dist1 := Round(Sqrt(SumOfSquares([a

abs(MouseStrut.pt.x-PHookR

if PHookRec1.MouseDistance < MAXDWORD-dist1 then // do not go over range

PHookRec1.MouseDistance := PHookRec1.MouseDistance+ dist1;

PHookRec1.LastMPt := MouseStrut.pt;

end;

end;

end;

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

and if you want to get the distance in Millimeters or inches, then you will need to Measure your monitor and do the math for the distance

Label2.Caption := IntTostr(Round(PHookRec1.M

{I measured my monitor screen and it was 324 millimeters wide

resolution was 1152x864 so 1152 / 324 is 3.555}