Click here to Skip to main content
15,897,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionUsing the xp theme calls - are they broken? Pin
Jim Crafton20-Feb-06 4:04
Jim Crafton20-Feb-06 4:04 
QuestionHow can service tell if reboot or shutdown? Pin
Anorexic Tribble20-Feb-06 3:40
Anorexic Tribble20-Feb-06 3:40 
AnswerRe: How can service tell if reboot or shutdown? Pin
Gavin Taylor20-Feb-06 6:04
professionalGavin Taylor20-Feb-06 6:04 
AnswerRe: How can service tell if reboot or shutdown? Pin
Gavin Taylor20-Feb-06 6:19
professionalGavin Taylor20-Feb-06 6:19 
AnswerRe: How can service tell if reboot or shutdown? Pin
Maximilien20-Feb-06 6:54
Maximilien20-Feb-06 6:54 
GeneralRe: How can service tell if reboot or shutdown? Pin
Anorexic Tribble20-Feb-06 7:51
Anorexic Tribble20-Feb-06 7:51 
GeneralRe: How can service tell if reboot or shutdown? Pin
Chris Meech20-Feb-06 9:26
Chris Meech20-Feb-06 9:26 
GeneralRe: How can service tell if reboot or shutdown? Pin
Anorexic Tribble20-Feb-06 10:20
Anorexic Tribble20-Feb-06 10:20 
The senario we have is that at the end of the day the power for our labs are turned off. This is for safety reasons. However the PC are protected by UPSs. If someone shuts down their PC, but forgets to switch off the UPS then the alarm goes off!!! Yours truly then spends the next few minutes trying to find which UPS is still switched on.

The solution is to write a service that schedules the UPS to power down as it is told that Windows is shutting down. The UPS doesn't power down immediately. Instead you instruct the UPS firmware to shut down after a timeout.

The problem is that the service will get the same notification if the user asks the PC to reboot. The result is that midway through the boot up sequence the power disappears. Unfortunately the UPS shutdown can not be aborted.


Chris Meech wrote:
On startup, does the service actually try to start-up the UPS?

Starting up the PC is not too much of a problem because the UPS auto starts when the AC is applied and the PC has its BIOS set to auto boot the PC.


Chris Meech wrote:
Can the service distinguish whether the PC is running off the main or battery?

<smugness>
Yes it can. It interrogates it though its HID interface.



Chris Meech wrote:
I think you need to trap the WM_POWER_BUTTON_PUSHED message and handle that instead.


It's called WM_ENDSESSION, but services don't receive Windows messages. Instead they receive control codes. Both the control code and the Windows message give no indication as to whether the PC is about to reboot.

What I was hoping was that there was some way that Windows could tell you that the PC was going to reboot and would therefore need some power. Be it a system call or a registry entry.
GeneralRe: How can service tell if reboot or shutdown? Pin
Chris Meech21-Feb-06 3:40
Chris Meech21-Feb-06 3:40 
GeneralRe: How can service tell if reboot or shutdown? Pin
Anorexic Tribble21-Feb-06 7:41
Anorexic Tribble21-Feb-06 7:41 
Questiondig itoa out Pin
LiYS20-Feb-06 3:34
LiYS20-Feb-06 3:34 
AnswerRe: dig itoa out Pin
Prakash Nadar20-Feb-06 3:52
Prakash Nadar20-Feb-06 3:52 
GeneralRe: dig itoa out Pin
BadKarma20-Feb-06 4:58
BadKarma20-Feb-06 4:58 
QuestionRegarding Path of MS outlook in various languages of windows Pin
rajeevktripathi20-Feb-06 2:45
rajeevktripathi20-Feb-06 2:45 
AnswerRe: Regarding Path of MS outlook in various languages of windows Pin
Michael Dunn20-Feb-06 11:04
sitebuilderMichael Dunn20-Feb-06 11:04 
QuestionUnicode data in Reg.dll Pin
meet2nishith20-Feb-06 1:38
meet2nishith20-Feb-06 1:38 
QuestionOptical Character recognition(OCR) Pin
Ankush Mehta20-Feb-06 1:22
Ankush Mehta20-Feb-06 1:22 
AnswerRe: Optical Character recognition(OCR) Pin
Cedric Moonen20-Feb-06 2:21
Cedric Moonen20-Feb-06 2:21 
QuestionAdding ATL Support to MFC Extension DLLs? Pin
a_kiani20-Feb-06 1:14
a_kiani20-Feb-06 1:14 
QuestionQUERY: strip trailing whitespace ... woes :S Pin
kevingpo20-Feb-06 1:13
kevingpo20-Feb-06 1:13 
AnswerRe: QUERY: strip trailing whitespace ... woes :S Pin
David Crow20-Feb-06 2:48
David Crow20-Feb-06 2:48 
AnswerRe: QUERY: strip trailing whitespace ... woes :S Pin
Wim Engberts20-Feb-06 3:14
Wim Engberts20-Feb-06 3:14 
QuestionCompiler Pin
Subramaniam s.V.20-Feb-06 0:41
Subramaniam s.V.20-Feb-06 0:41 
AnswerRe: Compiler Pin
Waldermort20-Feb-06 0:56
Waldermort20-Feb-06 0:56 
GeneralRe: Compiler Pin
David Crow20-Feb-06 2:54
David Crow20-Feb-06 2:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.