SRL Archive - SRL Archives

FreezeMouse ~ Mouse.scar


Rich

2009-08-25 14:45:54

Here are two functions that I made earlier whilst I was bored. They are FreezeMouse, and FreezeMousePos.

procedure FreezeMouse(X, Y, Rx, Ry, WaitMS : Integer);

What FreezeMouse does is freeze the mouse at X, Y for WaitMS milliseconds. If the mouse cursor is not already at X, Y, it will move the mouse to there with Rx, Ry randomness, and then wait.

procedure FreezeMouse(X, Y, Rx, Ry, WaitMS : Integer);
var
T, C, V : Integer;

begin
GetMousePos(C, V);
if (C <> X) or (V <> Y) then
MMouse(X, Y, Rx, Ry);
T:= GetSystemTime;
GetMousePos(C, V);
repeat
MoveMouse(C, V);
until((GetSystemTime - T) = WaitMS);
end;

procedure FreezeMousePos(WaitMS : Integer);

FreezeMousePos is similar to FreezeMouse except this freezes the mouse where it already is, for WaitMS milliseconds.

procedure FreezeMousePos(WaitMS : Integer);
var
X, Y : Integer;

begin
GetMousePos(X, Y);
FreezeMouse(X, Y, 0, 0, WaitMs);
end;

Comments?
Richard.

caused

2009-08-25 15:37:49

I'm not sure what this is good for actually :D..

Couldnt it be shortened to:
"Wait(time)"; ?

~caused

Rich

2009-08-25 15:56:49

I'm not sure what it's good for either, but I was bored and wanted to do something :p

And the point of this is to freeze the cursor, so that you can't even move it by moving the mouse. So, no, it couldn't use Wait().

Richard.

marpis

2009-08-25 17:03:32


MMouse(x, y, 0, 0);
wait(100+random(50));
???

Rich

2009-08-25 17:21:55

Marpis, I was bored and wanted to do something, so I came up with this. I know it may be pointless, but it gave me something to do.