How in C # to determine whether the laptop lid is closed?
It is necessary that the program performs actions only with the lid closed.
1 answer
The great and mighty comes to the rescue:
If you are a Lid Close Action changes. This is done by calling
RegisterPowerSettingNotification
(see http://msdn2.microsoft.com/en-us/library/aa373196.aspx for details). GUID_LIDCLOSE_ACTION. This is thewdm.h
in the Platform SDK.Once registered,
WM_POWERBROADCAST
will be set toPBT_POWERSETTINGCHANGE
. This is the time for the event.POWERBROADCAST_SETTING
structure (see http://msdn2.microsoft.com/en-us/library/aa372723.aspx ) containing information about the setting.
( from here )
|