473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

cancelling shut down from a console application

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

Aug 14 '06 #1
5 3123
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:
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
Aug 14 '06 #2
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:
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
Aug 14 '06 #3

ro*******@gmail.com wrote:
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

Aug 14 '06 #4
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

Aug 15 '06 #5

<ro*******@gmail.comwrote in message
news:11*********************@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
Aug 16 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: kuldeep | last post by:
Hi all, I have a application developed in C# .net. The problem I face is I am unable to shutdown my machine when the exe is running. Windows is unable to close this exe an shut down. Can anyone...
4
by: Claire | last post by:
Running XP pro, SP2. Visual studio .NET 2003. App written in C# I have written an application that hides itself when run and shows a notification icon in the system tray. If the main form is...
4
by: Diogo Alves - Software Developer | last post by:
Hi, I have a application developed by me in C# that does not let windows shut down! What is the problem? is this a Framework bug? I would like to receive some feedback about this issue
5
by: Anders Both | last post by:
If no pages in my asp.net web-system, is being requested for some periode, it seems like the asp.net process is shut down automaticaly. Is this a normal behavior, or does my system contains some...
3
by: BrianDH | last post by:
Hi I have a VB.Net windows application that for some reason when running will not allow the user to shut-down/reboot the Operating System without first closing my application. Has anyone had the...
5
by: Jeff S | last post by:
I'm creating a new Windows Forms MDI application... How can I add cause the application to shut itself down after a period of ? I did this in an old COM/VB6 application and I had to have code...
2
by: erdem | last post by:
Hi, I have a console program that handles events such as SHUTDOWN, LOGOFF. I took the source code from http://www.codeproject.com/win32/console_event_handling.asp What I try to do after...
1
by: TC | last post by:
I'm confused about the proper way to shut down my application. I have a form which instantiates a control, which instantiates another control, which instantiates yet another control that runs a...
2
by: Bill Davidson | last post by:
All: I have a Win32 service that takes about 30 seconds to shutdown (give or take a few seconds). I shut the service down via the 'Services' console on Windows Server 2003. When the service...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.