在Windows Forms应用程序,我杀了这样一个过程:如何杀死Windows Mobile中的进程?
Process[] ps = Process.GetProcessesByName("DataWedge");
foreach (Process p in ps)
p.Kill();
我怎么能做到这一点的Windows Mobile操作系统?
(此示例不会在Windows Mobile上运行。)
在Windows Forms应用程序,我杀了这样一个过程:如何杀死Windows Mobile中的进程?
Process[] ps = Process.GetProcessesByName("DataWedge");
foreach (Process p in ps)
p.Kill();
我怎么能做到这一点的Windows Mobile操作系统?
(此示例不会在Windows Mobile上运行。)
您需要枚举设备上运行的进程,以获得它的进程ID。一旦你已经得到了你的ProcessID可以做:
Process process Process.GetProcessById(processId);
process.Kill();
这里是一个article与枚举过程中的交易,它也包括一个杀例子也是如此。
由于上述文章不再存在,我使用Wayback Machine来获取article以使用代码。下面是你将如何使用代码从文章通过流程来枚举并杀死你想要的:
List<ProcEntry> processes = new List<ProcEntry>();
ProcessEnumerator.Enumerate(ref processes);
foreach (ProcEntry proc in processes)
{
if (proc.ExeName == "DataWedge.exe")
{
ProcessEnumerator.KillProcess(proc.ID);
}
}
感谢的的帮助,但我怎么能知道我需要的ProcessID? – Gold
您需要按进程名称检查枚举。 – GenericTypeTea
抱歉,无知......怎么办?我可以为此获取示例C#代码吗? – Gold