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
There is no documented way to find out if the workstation is currently locked. You can however get a notification when it un/locks. Subscribe the SystemEvents.SessionSwitch event, you'll get SessionSwitchReason.SessionLock and Unlock.
The sceen saver is troublesome too. Your main window gets the WM_SYSCOMMAND message, SC_SCREENSAVE when the screen saver turns on. You can pinvoke SystemParametersInfo to check if it running. You'll find sample code for this in my answer in this thread.
There is no good way to find out if the user fell asleep.