How to prevent power off from the power button
-
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
-
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
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
-
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
maybe it is some helpful to you http://www.codeproject.com/tools/standstillpcasp.asp[^]