麻烦各位检查一下,为什么我一个劲鼠标还会出现鼠标键盘不动的提示!(急!)
渔夫 2003-04-28 03:35:57 unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
AppEvnts, ExtCtrls;
type
TForm1 = class(TForm)
ApplicationEvents1: TApplicationEvents;
Timer1: TTimer;
procedure ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
var LastUserActionTime: Cardinal = 0;
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if ((Msg.Message >= WM_KEYFIRST) and (Msg.Message <= WM_KEYLAST)) or
((Msg.Message >= WM_MOUSEFIRST) and (Msg.Message <= WM_MOUSELAST)) then
LastUserActionTime := GetTickCount;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
LastUserActionTime := GetTickCount;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if GetTickCount - LastUserActionTime > 60 * 1000 then
showmessage('您一分钟没有移动鼠标键盘');
end;
end