Thread: Detecting lid close?

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    28

    Cool Detecting lid close?

    Learning noob here. Anyway, is it possible in C++ to detect the closing of my laptop's lid?
    Thanks in advance!

  2. #2
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    C++ is Turing complete
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    28
    Huh? Could you explain?

  4. #4
    Registered User
    Join Date
    Mar 2009
    Posts
    28
    Could this topic be moved to "Windows Programming" by an admin?

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Lid closing on a laptop is handled by the ACPI system. I'm not sure if there is any ACPI interface that allows user-mode code to get ACPI messages. I suspect not, as it's generally not something that user-mode applications do need to care about, so there is no reason to implement some way to forward that to the user-mode.

    Also, whist it is part of ACPI, it is implementation dependant.

    If there is no ACPI driver in the system, the BIOS will handle ACPI. Again, it's not possible for user-mode applications to get info out of BIOS.

    There's more info on ACPI here:
    http://www.microsoft.com/whdc/system...ver_Vista.mspx

    I don't know if there is a similar document for XP and older versions of NT-class OS's.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Close an HTTPListenerResponse.OutputStreram
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 04-23-2008, 11:00 PM
  2. open() and close()
    By SoFarAway in forum C Programming
    Replies: 3
    Last Post: 04-08-2005, 01:16 PM
  3. XWindows- Close window event?
    By Exile in forum Linux Programming
    Replies: 8
    Last Post: 01-09-2005, 10:39 PM
  4. Detecting program close
    By HybridM in forum Windows Programming
    Replies: 2
    Last Post: 01-17-2004, 10:08 AM
  5. Ghost in the CD Drive
    By Natase in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 10-12-2001, 05:38 PM