Click here to Skip to main content
15,890,399 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
i need a solution to this problem::confused:
i want a code detect when the lid of laptop closed or opened
Posted

You could intercept the system message that indicates that the computer is going into Sleep mode.

EDIT ====================

Unless the laptop has drivers that provide an additional system message indicating that the lid has closed, you're screwed. Beyond that, not all laptops would implement such a message, and you can't count on all of your users having the same laptop. You can only do so much.

Of course, you could probably write some driver software that helps you out, but then you get into the rather murky waters of compatibility ith ALL of the laptops ever made. Good luck with that.
 
Share this answer
 
v2
i want a another way, if user change the action from sleep to nothing
this will fall, i think WM_DEVICECHANGE would be useful ,
but how to determine that that the device removed is monitor or something else
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900