Hi
I have below code but it does not go at - process.WaitForExit(10000); // milliseconds
public static void RunVideo(string videolink)
{
Process process = new Process();
var _process = new ProcessStartInfo(@"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe", videolink);
//Process.Start(_process);
process.StartInfo = _process;
process.Start();
process.WaitForExit(10000); // milliseconds
process.Kill();
}
Thanks
Jignesh KumarPosted Dec 5, 2022, 3:23 AM
Hello Ramco,
Follow this link which will help you, You need to check below for waitforExist,
https://learn.microsoft.com/en-us/troubleshoot/developer/visualstudio/csharp/language-compilers/wait-shelled-app-finish
https://stackoverflow.com/questions/3520361/wait-till-process-is-no-longer-running-or-until-timeout-has-passed-whichever-ha
Sam HobbsPosted Dec 4, 2022, 11:28 PM
For Windows, Microsoft says we should not kill a process unless there is no other way to solve the problem. It should not be something done normally. For other operating systems, the term kill might be something we do normally, but not for Windows.
I am not sure what would be the best way to close an Edge window. If the user has selected to use tabs then closing one window might close all tabs. And if you are trying to use Edge to show a video then you need to wait until the video ends. You probably need to find something else to show the video.