delphi如何判断系统多长时间没有使用了
启动程序后,如何判断用户多长时间没有对程序进行操作了?

解决方案 »

  1.   

    很容易啊。启动程序时,用timer来计时,当有键盘或鼠标事件时,重新计时。
      

  2.   

    procedure TForm1.FormCreate(Sender: TObject);
    begin
      Application.OnIdle      := AppIdle;
    end;//==============================================================================
    //Application.空闲处理**********************************************************
    //==============================================================================
    procedure TForm1.AppIdle(Sender: TObject; var Done: Boolean);
    begin
      在这里可以处理,此事件就是程序空闲的事件
    end;
      

  3.   

    yeeyee(灌水低手)  
    有具体示范代码吗
      

  4.   

    function LastInput: DWord;
    var
      LInput: TLastInputInfo;
    begin
      LInput.cbSize := SizeOf(TLastInputInfo);
      GetLastInputInfo(LInput);
      Result := GetTickCount - LInput.dwTime;
    end;procedure TForm1.Timer1Timer(Sender: TObject);
    begin
     Label1.Caption := Format('System Idle since %d ms', [LastInput]);
    end;