So I have a WMV video file:
var fileName = @"C:\MyFolder\MyVideo.WMV"
and I am starting the video and getting my Process ID with the code:
var process = Process.Start(fileName);
if (process != null)
{
processId = process.Id;
}
Although my video file starts, process
is always null.
From Process.Start(string) MSDN I can see that:
Return Value Type:
System.Diagnostics.Process
A new Process that is associated with the process resource, or null if no process resource is started. Note that a new process that’s started alongside already running instances of the same process will be independent from the others. In addition, Start may return a non-null Process with its ProcessHasExited property already set to true. In this case, the started process may have activated an existing instance of itself and then exited.
It says that null is returned if no new process is started. But my process is started and null still returned. Why is this?