procedure TForm1.Button1Click(Sender: TObject);<br>Var<br> rtButton2: TRect;<br>Temp:integer;<br>begin<br> rtButton2 := Button2.BoundsRect;<br> MapWindowPoints(handle, 0, rtButton2, 2); // 座标换算<br> ClipCursor(@rtButton2); // 限制滑鼠移动区域<br>SystemParametersInfo(spi_screensaverrunning,1,@temp,0);<br>end;<br><br>或者:<br>procedure lockmouse(lock:boolean);<br>var rt:Trect;<br> p:Tpoint;<br>begin<br> if lock=true then<br> begin<br> GetCursorPos(p);<br> rt:=rect(p.x,p.y,p.x+1,p.y+1);<br> clipcursor(@rt);<br> end else clipcursor(nil);<br>end;//锁鼠标<br>假消息转换<br><br>procedure Timer.Ontimer(Sender:Tobject);<br>begin<br> asm<br> out 60h,0//乱填一个值<br> end;<br>end;<br><br>