procedure LockWorkStation; external user32 name 'LockWorkStation';
Procedure Tform1.wait(time1:integer);//time1是毫秒
var begin1:integer;
point1,point2:tpoint;
begin
getcursorpos(point1);
while true do
begin
application.ProcessMessages;
getcursorpos(point2);
if (point1.x<>point2.X) or (point1.y<>point2.y) then
begin
begin1:=gettickcount;
point1:=point2;
end
else
if gettickcount-begin1>=time1 then
begin
LockWorkStation;
break;
end;
end;
end;