Preventing Windows From Shutting Down

M

Mark

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.
 
E

Eric J Anderson

Mark said:
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.
 
J

Jonathan Roberts

Mark said:
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...
 
J

Jeremy

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!
 
J

Jonathan Roberts

Jeremy said:
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.
 
M

Michael A. Covington

<<You could issue "shutdown -a" from DOS. I assume you were looking for
Not DOS at all. Windows command prompt. 32-bit operating system.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top