Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to prevent power off from the power button

How to prevent power off from the power button

Scheduled Pinned Locked Moved C / C++ / MFC
securityhelptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nadzzz
    wrote on last edited by
    #1

    Hi everybody! Sorry for my bad english. I would like to programmatically prevent from powering of the computer with the power off button. but I dont care about holding the power off button 5 second to hard shut the computer. Just the smooth shutdown. in microsoft word, when you edit a document and do not save it. If you press the power down button ( digital type ), a Dialog will pop and ask you to save the document. If you press cancel, the System will not shut down and the application will stay active. I would like to do the same with my application. Thanks in advance for your help! Sébastien Nadeau Security Software Developper

    M H 2 Replies Last reply
    0
    • N nadzzz

      Hi everybody! Sorry for my bad english. I would like to programmatically prevent from powering of the computer with the power off button. but I dont care about holding the power off button 5 second to hard shut the computer. Just the smooth shutdown. in microsoft word, when you edit a document and do not save it. If you press the power down button ( digital type ), a Dialog will pop and ask you to save the document. If you press cancel, the System will not shut down and the application will stay active. I would like to do the same with my application. Thanks in advance for your help! Sébastien Nadeau Security Software Developper

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      Handle the WM_QUERYENDSESSION message and do your prompting there.

      --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

      1 Reply Last reply
      0
      • N nadzzz

        Hi everybody! Sorry for my bad english. I would like to programmatically prevent from powering of the computer with the power off button. but I dont care about holding the power off button 5 second to hard shut the computer. Just the smooth shutdown. in microsoft word, when you edit a document and do not save it. If you press the power down button ( digital type ), a Dialog will pop and ask you to save the document. If you press cancel, the System will not shut down and the application will stay active. I would like to do the same with my application. Thanks in advance for your help! Sébastien Nadeau Security Software Developper

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        maybe it is some helpful to you http://www.codeproject.com/tools/standstillpcasp.asp[^]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups