473,386 Members | 1,803 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,386 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 4241
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...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.