title: Service needs to detect if workstation is locked, and screen saver is active
body: <p>I'm working on a service that needs to detect user states for all user(s) logged on to a single machine. Specifically, I want to check to see whether or not the screen saver is active and whether or not their session is locked.</p>
  
  <p>This code will run under a system-level service, and has no visible UI, so that may rule out several options (trapping WM messages, etc).</p>
  
  <p>Aside from normal workstations, I'd like for this to work on terminal servers that have multiple users logged in to it. Due to these requirements I'm wondering if several Win32 APIs will need to be involved.</p>
  
  <p>Any ideas on where to begin?</p>