using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Diagnostics;
using System.Collections;
public partial class user_Exposure : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
//得到所有打开的进程
ArrayList procList = new ArrayList();
string tempName = "";
int begpos;
int endpos;
foreach (Process thisProc in Process.GetProcesses())
{
tempName = thisProc.ToString();
begpos = tempName.IndexOf("(") + 1;
endpos = tempName.IndexOf(")");
tempName = tempName.Substring(begpos, endpos - begpos);
procList.Add(tempName);
}
DropDownListProcname.DataSource = procList;
DropDownListProcname.DataBind();
}
private void KillProcess(string processName)
{
//得到所有打开的进程
try
{
foreach (Process thisProc in Process.GetProcessesByName(processName))
{
if (!thisProc.CloseMainWindow())
{ Button2.Text = thisProc.MainModule.FileName;
thisProc.Kill();
}
}
}
catch
{
}
}
protected void Button2_Click(object sender, EventArgs e)
{
KillProcess(DropDownListProcname.SelectedItem.Text);
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Diagnostics;
using System.Collections;
public partial class user_Exposure : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
//得到所有打开的进程
ArrayList procList = new ArrayList();
string tempName = "";
int begpos;
int endpos;
foreach (Process thisProc in Process.GetProcesses())
{
tempName = thisProc.ToString();
begpos = tempName.IndexOf("(") + 1;
endpos = tempName.IndexOf(")");
tempName = tempName.Substring(begpos, endpos - begpos);
procList.Add(tempName);
}
DropDownListProcname.DataSource = procList;
DropDownListProcname.DataBind();
}
private void KillProcess(string processName)
{
//得到所有打开的进程
try
{
foreach (Process thisProc in Process.GetProcessesByName(processName))
{
if (!thisProc.CloseMainWindow())
{ Button2.Text = thisProc.MainModule.FileName;
thisProc.Kill();
}
}
}
catch
{
}
}
protected void Button2_Click(object sender, EventArgs e)
{
KillProcess(DropDownListProcname.SelectedItem.Text);
}
}