你好,
我测试了一下代码,但是不会报异常,能贴出你的详细代码吗?
static void Main(string[] args)
{
DetermineProcess();
Console.ReadKey();
DetermineProcess();
Console.ReadKey();
DetermineProcess();
Console.ReadKey();
}
public static void DetermineProcess()
{
Process[] processes = null;
processes = Process.GetProcessesByName("OUTLOOK.EXE");
if (processes.Length == 0)
{
Process p = new Process();
p.StartInfo.FileName = "OUTLOOK.EXE";
p.Start();
Console.WriteLine("OpenProcess");
}
}
Paul Zhou [MSFT]
MSDN Community Support |
Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
