function LastInput: DWord; var LInput: TLastInputInfo; begin LInput.cbSize := SizeOf(TLastInputInfo); GetLastInputInfo(LInput); Result := GetTickCount - LInput.dwTime; end;//Example: procedure TForm1.Timer1Timer(Sender: TObject); begin Label1.Caption := Format('System Idle since %d ms', [LastInput]); end; // The GetLastInputInfo function retrieves the time // of the last input event. // Minimum operating systems: Windows 2000
to fanguluke(fan): 你说的这个事件和我说的不是一回事,你说的通信端口接收到一个数据可以用‘时间控件’timer就可以随时检测到的,我的说是应用程序处于空闲状态时触发的事件:只要应用程序在规定的时间内没有键盘、鼠标操作,就触发一个事件,执行某一任务,这个事件就是TApplication.OnIdle事件,但我不知道怎么去写这个事件的脚本。
function LastInput: DWord;
var
LInput: TLastInputInfo;
begin
LInput.cbSize := SizeOf(TLastInputInfo);
GetLastInputInfo(LInput);
Result := GetTickCount - LInput.dwTime;
end;//Example:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Label1.Caption := Format('System Idle since %d ms', [LastInput]);
end;
// The GetLastInputInfo function retrieves the time
// of the last input event.
// Minimum operating systems: Windows 2000
你说的这个事件和我说的不是一回事,你说的通信端口接收到一个数据可以用‘时间控件’timer就可以随时检测到的,我的说是应用程序处于空闲状态时触发的事件:只要应用程序在规定的时间内没有键盘、鼠标操作,就触发一个事件,执行某一任务,这个事件就是TApplication.OnIdle事件,但我不知道怎么去写这个事件的脚本。