Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if the current Windows session is locked or not?

I have an application which runs every hour on a Windows XP Machine. To run properly, this application requires the current session to be unlocked. So I was wondering if there a way to know if the current Windows session is locked or not with C# and .NET 3.5.

UPDATE: The application cannot listen to the SessionNotification events. The application can be kicked off anytime and terminates when completed.

Thanks!

like image 973
Martin Avatar asked Jun 19 '09 04:06

Martin


1 Answers

These are untested by me, but look interesting. I'd give them a test, but my Visual Studio appears to be less than happy with me at the moment.

  • Is there any way a program can know whether or not the computer is locked? (google cache link, thanks @hometoast) (link permanently dead)
  • Lots of information in this thread
  • If your app can run all the time and "wake up" once an hour, the SystemEvents.SessionSwitch event might help you out, there's an example in the thread above
like image 103
Dan F Avatar answered Oct 22 '22 20:10

Dan F