detect laptop lid close

  • Thread starter Thread starter gordonjones
  • Start date Start date
G

gordonjones

I need to have my laptop not disconnect from the network when I close
it but still lock itself (ctl+alt+del)

If I use Suspend or Hibernate the network connection is lost. Having
the screen saver set to 5 or 10 mins is just annoying. Can I write a
small program to call "LockWorkstation" when the laptop lid closes???
Where do I even start?

Thanks
 
(e-mail address removed) wrote in 22g2000hsm.googlegroups.com:
I need to have my laptop not disconnect from the network when I close
it but still lock itself (ctl+alt+del)

If I use Suspend or Hibernate the network connection is lost. Having
the screen saver set to 5 or 10 mins is just annoying. Can I write a
small program to call "LockWorkstation" when the laptop lid closes???
Where do I even start?

So you want to prevent a machine from going into stand by? You'll need to
hook into the Power Management APIs:

http://msdn2.microsoft.com/en-us/library/ms704147.aspx

http://msdn2.microsoft.com/en-us/library/Aa373247.aspx

BTW, you could just tell your users to disable standby when closing the lid
- that's probably a better idea than trying to override standby and sucking
a user's battery.
 
Thanks for replying, I reviewed the links you sent and it sounds like
you have to have the laptop's Suspend or Hibernate modes ACTIVATED in
order to have the Power Management APIs available... would I then just
catch them and prevent Suspend mode from completing until Resume is
called???

What would I need to use to be able to detect the lid close button
being pushed? Would that be manufacturer specific?

Thanks
 
Back
Top