How can I determine whether machine is going into sleep or hibernate RRS feed

  • Question

  • Hi,

    I've searched all over and still haven't been able to come up with a good way to approach this.  I have a service running that will delay power state changes slightly while some processing occurs.  This is done by catching the SERVICE_CONTROL_POWEREVENT control code.  As it turns out, now I need to be able to determine whether the computer is going into sleep or into hibernate.  I see there are two different defines for this:


    #define PBT_APMSUSPEND                  0x0004
    #define PBT_APMSTANDBY                  0x0005

    but it's documented that only PBT_APMSUSPEND is used.  Once this control code is called, what's the best way to determine what the destination power state is.  All my searching so far has left me with nothing, so any ideas would be greatly appreciated.


    Also, if this should be in a different topic, please let me know.  Thanks!!

    Tuesday, May 13, 2008 5:10 PM