Connecting Tech Pros Worldwide Help | Site Map

cancelling shut down from a console application

erdem
Guest
 
Posts: n/a
#1: Aug 14 '06
Hi,

I have a console program that handles events such as SHUTDOWN, LOGOFF.
I took the source code from

http://www.codeproject.com/win32/con...t_handling.asp

What I try to do after catching shutdown event is to be able to cancel
it.

Is there a windows function that cancels shut down, or is there any way
of doing it.

Thanks

Erdem

robertark@gmail.com
Guest
 
Posts: n/a
#2: Aug 14 '06

re: cancelling shut down from a console application


In windows CMD menu, it's "shutdown /a" -- No quotes..

/a means abort the shutdown process (if initiated by shutdown [/r] [/s]
[/t s] [/c])

Hope this helps.
erdem wrote:
Quote:
Hi,
>
I have a console program that handles events such as SHUTDOWN, LOGOFF.
I took the source code from
>
http://www.codeproject.com/win32/con...t_handling.asp
>
What I try to do after catching shutdown event is to be able to cancel
it.
>
Is there a windows function that cancels shut down, or is there any way
of doing it.
>
Thanks
>
Erdem
robertark@gmail.com
Guest
 
Posts: n/a
#3: Aug 14 '06

re: cancelling shut down from a console application


In windows CMD menu, it's "shutdown /a" -- No quotes..

/a means abort the shutdown process (if initiated by shutdown [/r] [/s]
[/t s] [/c])

Hope this helps.
erdem wrote:
Quote:
Hi,
>
I have a console program that handles events such as SHUTDOWN, LOGOFF.
I took the source code from
>
http://www.codeproject.com/win32/con...t_handling.asp
>
What I try to do after catching shutdown event is to be able to cancel
it.
>
Is there a windows function that cancels shut down, or is there any way
of doing it.
>
Thanks
>
Erdem
Siam
Guest
 
Posts: n/a
#4: Aug 14 '06

re: cancelling shut down from a console application



robertark@gmail.com wrote:
Quote:
In windows CMD menu, it's "shutdown /a" -- No quotes..
>
/a means abort the shutdown process (if initiated by shutdown [/r] [/s]
[/t s] [/c])
>

This works, provided the shutdown process hasn't already been started.
If the system is already shutting down, any call like the above will
return an error along the lines of "The process failed to initialize
because the system is shutting down".

Siam

erdem
Guest
 
Posts: n/a
#5: Aug 15 '06

re: cancelling shut down from a console application


Yeah,

it does not work because, the shutdown process has been started when I
call the shutdown -a by using ShellExecute.

It gives an error with the code 0xC0000142,

Thanks

Erdem

Howard
Guest
 
Posts: n/a
#6: Aug 16 '06

re: cancelling shut down from a console application



<robertark@gmail.comwrote in message
news:1155543560.464588.10920@75g2000cwc.googlegrou ps.com...

Please don't top-post. And please keep discussions on-topic. Windows
questions (and answers) belong in a windows newsgroup, not here.

See the FAQ, especially section 5:

http://www.parashift.com/c++-faq-lite/

-Howard


Closed Thread