如题!用什么方法来实现,是否用一定时器统计一段时间内是否有鼠标与键盘事件,
系统的鼠标与键盘事件如何获取?

解决方案 »

  1.   

    应该是使用hook 全局钩子吧....
      

  2.   

    定义一个ROCK窗体。然后一个Timer在onTimer事件上面写
    Application.OnIdle:=showROck;
    showROck;过程为自己定义,show出rock窗体,show模式要是showmodal。
      

  3.   

    user32.dllGetLastInputInfohttp://blog.csdn.net/jinjazz/archive/2008/02/21/2110620.aspx
      

  4.   

    Delphi的unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ExtCtrls;type
      TForm1 = class(TForm)
        Timer1: TTimer;
        procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;  function BlockInput(fFreezeInput : boolean):DWord; stdcall; external 'user32.DLL';var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Timer1Timer(Sender: TObject);
    var
      vLastInputInfo: TLastInputInfo;
    begin
      vLastInputInfo.cbSize := SizeOf(vLastInputInfo);
      GetLastInputInfo(vLastInputInfo);
      if GetTickCount - vLastInputInfo.dwTime > 3000 then
      begin
        timer1.Enabled:= false;
        BlockInput(True);
        showmessage('超过3秒,已锁定!');
      end;
    end;end.
      

  5.   

    把界面上的控件disable掉么好了