Hi
Error - Error - An object reference is required for non static field , method or property Process.Kill
I have below code and it is giving me above error on process.kill
public static void RunVideo(string videolink)
{
var _process = new ProcessStartInfo(@"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe", videolink);
Process.Start(_process);
Process.Kill();
}
Thanks
Ramco RamcoPosted Dec 2, 2022, 2:24 PM
Hi Vishal
Loop is not working . I am reading 4-5 videos from Database . I want it should repeat 1 after other. It stops after first video.
It should kill that process & start new process . I think then it will work.
Vishal YelvePosted Dec 2, 2022, 2:19 PM
Please share you complete code.. coz its working properly at my end
Ramco RamcoPosted Dec 2, 2022, 2:07 PM
Hi Visahl
On item.kill it is giving access denied.
Thanks
Vishal YelvePosted Dec 2, 2022, 1:47 PM
Hi Ramco,
Try this.
Ramco RamcoPosted Dec 2, 2022, 12:16 PM
Hi Vishal
Kindly check at your end it is not going at this point. AT process.start Video starts but it is not going at below point .
process.WaitForExit(10000);
// milliseconds process.Kill();
Thanks
Ramco RamcoPosted Dec 2, 2022, 12:10 PM
Hi Vishal
On process.kill it is giving error - Cannot process request because the process has exited.
Video also run only 1 time
Thanks
Vishal YelvePosted Dec 2, 2022, 12:04 PM
Hi Ramco,
Try this, I have tested
Ramco RamcoPosted Dec 2, 2022, 11:45 AM
Hi Vishal
It is giving message No process is associated with this object.
Thanks
Vishal YelvePosted Dec 2, 2022, 11:32 AM
Try this
Ramco RamcoPosted Dec 2, 2022, 9:59 AM
Hi AMit
If i do like this Video does not run. It opens multiple Browser windows
I want it should run & browser gets close.
for (int i = 0; i < 10; i++)
{
//https://www.youtube.com/watch?v=M-FfmU2ieOI
RunVideo("youtube.com/watch?v=M-FfmU2ieOI?autoplay=1");
}
Amit MohantyPosted Dec 2, 2022, 9:52 AM
Try this