Jon Jacobs

Jon Jacobs

  • NA
  • 20
  • 0

How do I kill a process I use to show an image file?

Mar 31 2023 4:49 PM

Process proc=null;//declaration at top of windows form code

proc = Process.Start(imagefilename);

if (proc != null) proc.Kill();

but proc is always null.

if I use proc = new Process(); proc.StartInfo.FileName=imagefilename; proc.Start(); proc.Kill()//after image showing. gives no process associate error. Help! I am using VS 2012 Express because I have to use and create Windows Forms and newer version don't support that well or at all.


Answers (6)