Hi all:
how do i kill a process after say 2 or three minutes look at the following code:
class Program
{
static void Main(string[] args)
{
try
{
//declare new process and name it p1
Process p1 = Process.Start("iexplore", "http://www.google.com");
//get starting time of process
DateTime startingTime = p1.StartTime;
Console.WriteLine(startingTime);
//add a minute to startingTime
DateTime endTime = startingTime.AddMinutes(1);
//I don't know how to kill process after certain time
//code below don't work, How Do I kill this process after a minute or 2
p1.Kill(startingTime.AddMinutes(2));
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine("Problem with Process:{0}", ex.Message);
}
}
}
so I want that IE window closed after 2 minutes