Good time of day!
There is an application that opens the links in the list. On a weak computer, if 10 such links are opened, the browser will hang. In this regard, I have to close the browser. Everything happens like this:

Process proc = new Process(); proc.StartInfo.FileName = str; proc.Start(); 

where str is some kind of link. The question is that after the delay, the default browser in which the link is opened must be closed.

In response to proc.Kill() writes

There are no processes associated with this object.

Is there any other way than to go into the registry and learn the default browser from there?

UPD. WindowsFormsApplication application

2 answers 2

Use Selenium to control a specific browser.

It is generally illogical to open links in the default browser, and then try to do something with it. Only chrome spawns a separate process per tab, so in all other browsers, nailing the process will not close one tab.

  • And even Chrome has long been using 1 process for several tabs. - Pavel Mayorov

Well, immediately after starting the process, pull the name of the executable file from the properties. Find all the processes running from this executable file and dunk them all, dunk in try..catch blocks with an empty catch ... Or maybe you shouldn't touch the browser? Display through the built-in WebNavigator and do whatever you want with it (only it works on the basis of IE with all the consequences)

  • one
    Add: instead of WebNavigator you can use Awesomium , made on the basis of the browser Chromium . - Pavel Mayorov