473,322 Members | 1,268 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,322 software developers and data experts.

Preventing Windows From Shutting Down

It is possible from a .NET application to prevent Windows from shutting
down?

I understand that a .NET application can "know" that windows is initiating
the process of to shutting down - but what about *preventing* that shutdown?

(and yes - I know the user can always unplug the machine)

Thanks.
Aug 1 '06 #1
7 1819
Also interested in this question.

Mark wrote:
It is possible from a .NET application to prevent Windows from shutting
down?

I understand that a .NET application can "know" that windows is initiating
the process of to shutting down - but what about *preventing* that shutdown?

(and yes - I know the user can always unplug the machine)

Thanks.
Aug 2 '06 #2
Mark wrote:
It is possible from a .NET application to prevent Windows from shutting
down?

I understand that a .NET application can "know" that windows is initiating
the process of to shutting down - but what about *preventing* that shutdown?

(and yes - I know the user can always unplug the machine)

Thanks.

Also interested.
Aug 2 '06 #3

"Mark" <A@B.COMwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
It is possible from a .NET application to prevent Windows from shutting
down?

I understand that a .NET application can "know" that windows is initiating
the process of to shutting down - but what about *preventing* that
shutdown?
>
(and yes - I know the user can always unplug the machine)

Thanks.

You could issue "shutdown -a" from DOS. I assume you were looking for a way
native to C# though...
Aug 2 '06 #4
RE:
<<You could issue "shutdown -a" from DOS. I assume you were looking for a
way native to C# though...>>

Would you know offhand if doing that works only if the shutdown was
initiated from DOS (or from the same DOS session).

What I'm getting at is this: IF there is no way native to C#, then my C#
could respond to its detection of the shutdown being initiated, then call a
batch file that does the "shutdown -a". Would that scenario be expected to
reliably abort the shutdown?

Thanks!
Aug 2 '06 #5

"Jeremy" <A@B.COMwrote in message
news:eO**************@TK2MSFTNGP02.phx.gbl...
RE:
<<You could issue "shutdown -a" from DOS. I assume you were looking for a
way native to C# though...>>

Would you know offhand if doing that works only if the shutdown was
initiated from DOS (or from the same DOS session).

What I'm getting at is this: IF there is no way native to C#, then my C#
could respond to its detection of the shutdown being initiated, then call
a
batch file that does the "shutdown -a". Would that scenario be expected to
reliably abort the shutdown?

Thanks!

Unfortunately, I don't. I am just learning C# now so my knowledge of
anything in C# at this point is very minimal. My best advice would be to
try it.
Aug 2 '06 #6
><<You could issue "shutdown -a" from DOS. I assume you were looking for
>a
way native to C# though...>>

Would you know offhand if doing that works only if the shutdown was
initiated from DOS (or from the same DOS session).
Not DOS at all. Windows command prompt. 32-bit operating system.
Aug 2 '06 #7
Hi !

So far I understand your question, you'll prevent it by you application.
There is an example in the SDK, see:

http://msdn2.microsoft.com/en-us/lib...ionending.aspx

Best regards,
Manfred

Mark wrote:
It is possible from a .NET application to prevent Windows from shutting
down?

I understand that a .NET application can "know" that windows is initiating
the process of to shutting down - but what about *preventing* that shutdown?

(and yes - I know the user can always unplug the machine)

Thanks.

Aug 2 '06 #8

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

Similar topics

10
by: Jesper | last post by:
Does anyone know some c++ code for shutting down windows? I want to write a program using borland c++ builder to shut down windows. --
3
by: Shailesh S. Gokhale | last post by:
Hi All! Recently I installed mysql on a win98. Some 2 days after the installation the system started experiencing a problem shutting down. When shutting down the hard-disk kept spinning...
3
by: Claire | last post by:
Windows refuses to close down if my applications main form is hidden and there's a notify icon in the system tray. If I restore the form, then shutting down Windows succeeds. If I comment out the...
3
by: quilkin | last post by:
Hi When I use the WM_QUERYENDSESSION event to prevent closing of my app when Windows is shut down, I get the 'windows forms parking window' appearing which is very confusing for users. Any ideas...
2
by: Peter Meinl | last post by:
Restarting Windows seems not to fire the OnShutdown event in the Windows Service. Does not work on Windows XP SP2 and not on Windows 2003 Server SP1. OnStart and OnStop do work fine. Steps...
4
by: Markus Stoeger | last post by:
Hi, I have a problem with Application.Run() when Windows is shutting down. Please have a look at the copy&paste example program below. The application has no forms. It has only got a notify...
7
by: Mark | last post by:
It is possible from a .NET application to prevent Windows from shutting down? I understand that a .NET application can "know" that windows is initiating the process of to shutting down - but...
3
by: Chris Knievel | last post by:
Hi, i am trying to save some data in a excel spreadsheet, whenever the programm shuts down. Mostly this happens when a user is logging off or shuts the computer down. im am using the Private Sub...
3
by: leocwh | last post by:
Dear all, I would like to know how to run the execuatable before windows shutting down. Here is my simple code: Private Sub Command1_Click() Shell "C:\abc.bat", vbNormalFocus End Sub ...
2
by: mikemiller.innova | last post by:
I developed a C# Windows App that requires a user to input their real name and what they did to the server while they were online. I am going to launch the app att shutdown via a logoff script. ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.