I'm making a program which opens a configured application after with the passed paramters through an url with shell execute. I achieved this with the following:

ProcessStartInfo procinfo = new ProcessStartInfo(URI);
procinfo.UseShellExecute = true;
Process App = Process.Start(procinfo);

I want to kill this process later after some minutes through this project that I could do by App.Kill() but the problem is that the Process.Start() always returns null if I pass the URI. How could I reach that process?

有帮助吗?

解决方案

If the address of the executable file to start is a URL, the process is not started and null is returned. http://msdn.microsoft.com/en-us/library/53ezey2s.aspx

Even if you specify a browser, the process could be a simple handler that sends a message to an existing process (or opens another process) and closes itself immediately.

But you may explicitly launch the browser you want if you know how its process works.

Process p = Process.Start(browserExePath, url);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top