你查查以前的贴子,有许多(Id:443460讲得很实用)<br>以下是摘抄xujiancai和Fyx的回答:<br><br>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><br>end;<br><br>锁鼠标上面说了,锁键盘:<br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> Asm //封锁20端口<br> IN AL,21H<br> OR AL,02H<br> OUT 21H,AL<br> end;<br>end;<br><br>解锁键盘:<br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br> Asm //解锁20端口<br> IN AL,21H<br> AND AL,0FDH<br> OUT 21H,AL<br> end;<br>end;<br><br>