Solved

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

Posted on 2008-06-15
2
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
zveljkovic earned 250 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 250 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

627 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