Delphi-Quellcode:
procedure TForm1.CalcMouseVel;
var MouseX, MouseY : integer;
begin
// Compensate for window origin vs. screen origin.
MouseX := Mouse.CursorPos.X - Form1.ClientOrigin.X;
MouseY := Mouse.CursorPos.Y - Form1.ClientOrigin.Y;
Label1.Caption := Format('Mouse velocity: %d, %d', [MouseVelX, MouseVelY]);
end;
So kann man sie ermitteln, wenn man das ganze durch einen Timer aulöst.