Eld*_*Mor 2 .net c# user-input screensaver
我有一个桌面应用程序,我想知道两件事:
我正在使用C#/ .NET.您如何建议解决这两项任务?
注意:WIN32调用和任何非托管代码解决方案一样好.
http://dataerror.blogspot.com/2005/02/detect-windows-idle-time.html
^检测Windows空闲时间.:)
此功能的启用程序是GetLastInputInfo()Win32 API和LASTINPUTINFO Win32结构.
以下是检测屏幕保护程序是否正在运行的代码.有关详细信息,请参阅此
const int SPI_GETSCREENSAVERRUNNING = 114;
[DllImport( "user32.dll", CharSet = CharSet.Auto )]
private static extern bool SystemParametersInfo(
int uAction, int uParam, ref bool lpvParam,
int flags );
// Returns TRUE if the screen saver is actually running
public static bool GetScreenSaverRunning( )
{
bool isRunning = false;
SystemParametersInfo( SPI_GETSCREENSAVERRUNNING, 0,
ref isRunning, 0 );
return isRunning;
}
Run Code Online (Sandbox Code Playgroud)