Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I terminate a process which has a shutdown procedure?

Posted on 2008-06-15
2
Medium Priority
?
257 Views
Last Modified: 2013-12-17
I need to shut down a C# program of mine from another C# program of mine.  Here's the ode I use to shut down proceses:

System.Diagnostics.Process[] process = Process.GetProcessesByName( processName );
if ( process.Length > 0 )
{
     process[0].Kill();
}

the problem is that in order to protect the program from being shut down by a casual operator mistake, I require a password.  But when shutting down automatically, there is no opportunity for a password.

How would I terminate it and have it "know" to bypass the code I included to check for a password?

Thanks for the help,
newbieweb
0
Comment
Question by:newbieweb
2 Comments
 
LVL 4

Accepted Solution

by:
zveljkovic earned 1000 total points
ID: 21789951
I think this will help you.
http://articles.techrepublic.com.com/5100-10878_11-6170794.html

Hope that helps,
Zlax
0
 
LVL 16

Assisted Solution

by:CuteBug
CuteBug earned 1000 total points
ID: 21790665
You can communicate with the C# application (which has to be shutdown) from your C# application using named pipes. Send it a message say ("SHUTDOWN", "<password>").
Once the C# application receives this message it can check whether the password is correct and then proceed with the shutdown.

Check this link for more details on Inter Process Communication using Named Pipes:
http://blog.paranoidferret.com/index.php/2007/07/25/interprocess-communication-using-named-pipes-in-csharp/
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question