How to open a web page from a WinForms application while keeping the browser in the background?

I am currently writing in C #, and I usually open the links in the default system browser as follows: System.Diagnostics.Process.Start("http://www.link.com");

This is definitely what I want most of the time. However, I also want to implement a small function, if the user visits the middle link in my user interface, I open this link in the background and my application stays on top, so the user can open many links in a line. (Basically, I want to do something similar to what the browser does with an average click, but I'm not a browser.)

The best hack I can think of is setting Form.TopMost = true before opening the page and then turning it off after a second, but this seems like a pretty crappy solution, and this would prevent the fast user from opening the browser at that time. Can anyone suggest something less hacked?

+4
source share
1 answer

after opening the webpage use this.Focus(); in your code

+1
source

Source: https://habr.com/ru/post/1400661/


All Articles