如何使应用程序在一段时间内没有用户输入时自动锁定?

解决方案 »

  1.   

    check, how long the system is Idle?  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;