**************************************** ******************** Open Process **************************************** *
First use: Using System. diagnostics;
Then fill in the event
Process proc = Process. Start ( " Notepad " );
**************************************** ********************* Close Process ****************************************
Method 1:
Call the following method:
Private Void Killprocess ( String Processname)
{
System. Diagnostics. Process myproc = New System. Diagnostics. Process ();
// Obtain all open processes
Try
{
Foreach (Process thisproc In Process. getprocessesbyname (processname ))
{
If ( ! Thisproc. closemainwindow ())
{
Thisproc. Kill ();
}
}
}
Catch (Exception exc)
{
MessageBox. Show (EXC. Message );
}
}
Method 2:
Enter the following information in the event:
System. Diagnostics. Process [] myprocesses = System. Diagnostics. process. getprocesses ();
Foreach (System. Diagnostics. Process myprocess In Myprocesses)
{
If ( " Sqlservr " = Myprocess. processname)
{
Myprocess. Kill ();
}
}
Ninetynine reference network and some original