Detecting if the screensaver is active and/or the user has locked the screen in Windows

前端 未结 6 1061
遇见更好的自我
遇见更好的自我 2020-12-09 06:50

I\'m writing an app that at times will send notifications to the user in the form of toaster messages.

If the user is not there, he can\'t see the notification. So w

6条回答
  •  不思量自难忘°
    2020-12-09 07:09

    Use SystemParametersInfo to detect whether screen saver is running - the calltype is SPI_GETSCREENSAVERRUNNING. This is supported on Win2000 and above.

    There is code from @dan_g on StackOverflow here to check if wksta is locked.

提交回复
热议问题