关于键盘:<br>var KHK: HHook;<br> tmp: integer;<br>function HookProc(ICode: integer;WP:WParam;LP:LParam):LResult;<br>begin<br> Result:=CallNextHookEx(KHK,0,0,0);<br>end;<br>开始锁定:<br>KHK:=SetWindowsHookex(WH_JOURNALPLAYBACK,@HookProc,HInstance,0);<br>结束锁定:<br>UnHookWindowsHookEx(KHK);<br>这时候不能屏蔽Windows的系统键Ctrl+Alt+Tab,Ctrl+Esc,Alt+Tab等<br>你就可以使用:<br>SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, @tmp, 0);//锁起来<br>SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, @tmp, 0);//打开吧<br><br>关于鼠标:<br>procedure TMyForm.RestrictMouse ;//限制鼠标<br>var<br> r : TRect ;<br>begin<br> r := Rect(Left, Top, Left + Width, Top + Height) ;<br> ClipCursor( @r ) ;<br>end ;<br>procedure TMyForm.UnRestrictMouse ;//解除鼠标限制<br>begin<br> ClipCursor( nil ) ;<br>end ;