How to detect inactive user

后端 未结 4 687
醉梦人生
醉梦人生 2020-12-12 18:09

How to detect inactive (idle) user in Windows application? I\'d like to shutdown application when there hasn\'t been any input (keyboard, mouse) from user for certain period

4条回答
  •  不思量自难忘°
    2020-12-12 18:43

    You might want to see the answer to this question: How to tell when Windows is inactive [1] it is basically same question the solution suggested is to use the GetLastInputInfo [2] API call.

    This post explains some aspects as well: (The Code Project) How to check for user inactivity with and without platform invokes in C# [3]

    [1] How to tell when Windows is inactive
    [2] http://msdn.microsoft.com/en-us/library/ms646302%28VS.85%29.aspx
    [3] http://www.codeproject.com/KB/cs/uim.aspx

提交回复
热议问题