none
Lid Close Action change notification

    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
  •  

    Anyone want to make $25-30/hr tutoring me via phone?  This can be done in off-hours late nights and weekends and I can pay via paypal.  I just installed Visual Studio 2008 Beta 2 and I am looking for someone to help me come up to speed on C++, C# and VB.  I haven't touched Visual Studio since 6.0, so I am a bit out of date.  Also, I'm entirely self-taught, so I would like someone who can show me how to start from scratch and set things up 'correctly'.  My focus is on creating a simple C++ form app using CLR specifically for Vista.  I need to know the correct method for reading/writing files, and I would like to learn how to use RegisterPowerSettingNotification to catch the WM_POWERBROADCAST message in C++, C# and VB.  If you can control a serial port, that would be great too.

     

    Currently I am creating an application to control my home projector, but this is really just a learning experience to help me come up to speed again.

     

    My email address is ima_computer@yahoo.com

     

    Thanks!

     

      - Ed

     

     

    Friday, November 2, 2007 5:19 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