jak mogę zabić proces po powiedzieć 2 lub trzy minuty spojrzeć na poniższy kod:Process Zabij po pewnym czasie + C#
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);
}
}
}
więc chcę, że IE okno zamknięte po 2 minutach
p1.WaitForExit (60000); // DateTime endTime2; p1.CloseMainWindow(); // endTime2 = p1.ExitTime; p1.Close(); – Developer