How in C # to determine whether the laptop lid is closed?
It is necessary that the program performs actions only with the lid closed.
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 the
wdm.hin the Platform SDK.
WM_POWERBROADCASTwill be set to
PBT_POWERSETTINGCHANGE. This is the time for the event.
POWERBROADCAST_SETTINGstructure (see http://msdn2.microsoft.com/en-us/library/aa372723.aspx ) containing information about the setting.
( from here )