locked
Lid Close Action change notification RRS feed

  • Question

  • Hi,

    I am writing a code in which I require the notification whenever Lid Close Action is

    changed by user in Power Manager (Control Panel).

     

    Is there any way to receive this notification in Vista 32-bit and XP operating system?

     

    Thanks in advance.

     

    Regards,

    Atul

    Wednesday, May 9, 2007 2:44 AM

Answers

  • In Vista you can register for a callback for when the Lid Close Action changes.  This is done by calling RegisterPowerSettingNotification (see http://msdn2.microsoft.com/en-us/library/aa373196.aspx for details).  The GUID for this power setting you're interested in is GUID_LIDCLOSE_ACTION.  This is defined in wdm.h in the Platform SDK.   

     

    Once registered, a WM_POWERBROADCAST will be sent to your application with wParam set to PBT_POWERSETTINGCHANGE.   This event is sent anytime the value for the lid close action changes.  The lParam contains a pointer to a POWERBROADCAST_SETTING structure (see http://msdn2.microsoft.com/en-us/library/aa372723.aspx) containing information on the setting change. 

     

    Stephen [MS]

    Wednesday, May 30, 2007 11:26 PM

All replies

  • In Vista you can register for a callback for when the Lid Close Action changes.  This is done by calling RegisterPowerSettingNotification (see http://msdn2.microsoft.com/en-us/library/aa373196.aspx for details).  The GUID for this power setting you're interested in is GUID_LIDCLOSE_ACTION.  This is defined in wdm.h in the Platform SDK.   

     

    Once registered, a WM_POWERBROADCAST will be sent to your application with wParam set to PBT_POWERSETTINGCHANGE.   This event is sent anytime the value for the lid close action changes.  The lParam contains a pointer to a POWERBROADCAST_SETTING structure (see http://msdn2.microsoft.com/en-us/library/aa372723.aspx) containing information on the setting change. 

     

    Stephen [MS]

    Wednesday, May 30, 2007 11:26 PM
  • Is it possible for me to do something like ::BroadcastSystemMessage() to post WM_POWERBROADCAST with GUID_LIDCLOSE_ACTION id. I am trying to see if i can notify driver of a lid close event.

    Thanks,

    Geoff
    Tuesday, March 31, 2009 2:24 PM
  • You should use GUID_LIDSWITCH_STATE_CHANGE instead of GUID_LIDCLOSE_ACTION to detect whether the Lid is closed/opened. The GUID value is 0xBA3E0F4D, 0xB817, 0x4094, 0xA2, 0xD1, 0xD5, 0x63, 0x79, 0xE6, 0xA0, 0xF3.
    Monday, June 1, 2009 11:22 AM