locked
Detecting resume from standby and reboots? RRS feed

  • Question

  • I need something that will log the time the computer came out of standby, or the user logs in the first time from a reboot.

    Basically, I want to time computer usage but in simple terms where computer is being used after waking or after rebooting.

    So, All I need is a detection scheme. Does windows provide that? I am probably targeting .NET but can do Win32 API. Or do I have to do anything like that all?

    I am thinking if I make a service, windows will handle the launching of the service and that way I can detect usage. But is that the most efficient way?

    I am using XP Pro and Visual Studio 2005

    All comments appreciated.

    E



    Thursday, August 13, 2009 5:19 PM

Answers

  • Well whatever the case is, you'll have to filter the events from the EventLog and then use them. These events should stay logged in the EventLog in case of Sleep, Reset, Reboot etc.
    • Marked as answer by EricEric Monday, August 17, 2009 2:21 PM
    Monday, August 17, 2009 2:19 PM

All replies

  • Windows keep these 2 events in its Security event log as a part of Security Auditing policy. If not enabled, you can enable the tracking of these events by using "Local Security Policy" under the "Administrative Tools".


    Using .Net you can create an object of EventLog class and access and filter all events related to login, reboot etc.
    Friday, August 14, 2009 8:34 PM
  • Thanks for your reply.

    How would I go about 'knowing' when the computer comes out of standby, sleep or hibernate. I also need to know when it comes on the first time (powers up).

    Would a service be the best idea? Or can I simply build something for startup and run it as a low priority process?
    Monday, August 17, 2009 1:32 PM
  • Depends upon your need. If you want something that keeps running in the background, irrespective of who logs in, use a Service. Otherwise to keep it simple, use a EXE program in startup.
    Monday, August 17, 2009 2:03 PM
  • Ok, thanks. I still am unsure if a service goes to sleep just as a computer does. Yet still, what will a process for an exe do? Go to sleep as well? These unknowns I will have to test out unless someone knows for sure and can chime in.



    Monday, August 17, 2009 2:08 PM
  • Well whatever the case is, you'll have to filter the events from the EventLog and then use them. These events should stay logged in the EventLog in case of Sleep, Reset, Reboot etc.
    • Marked as answer by EricEric Monday, August 17, 2009 2:21 PM
    Monday, August 17, 2009 2:19 PM
  • Thanks, gupta. I will do that. I appreciate your assistance on this.

    Monday, August 17, 2009 2:21 PM