I\'m writing a Windows Service application which listens for connections and performs certain tasks as instructed from a different application running on another computer on
Use WTSGetActiveConsoleSessionId() to determine whether anybody is logged on locally. Use WTSEnumerateSessions() to determine if there is any session at all (including remote terminal services sessions).