Opening a minimized browser in Windows Forms

-1

I'm doing an application in Windows Forms and I have the following problem, when the user clicks on a form button, he will have to maximize a minimized internet page, that is, bring the browser window to the foreground and maximize it.

I just found codes that open a new page:

ProcessStartInfo startInfo = new ProcessStartInfo("iexplore.exe", "http://www.google.com/");

But that would not be the intention.

    
asked by anonymous 15.10.2018 / 14:33

1 answer

0

This is a very specific problem. Since you can pass some arguments to the application, it is only the product developer who decides what is possible or not to do with these arguments.

It's a bit tricky to find "gambiarras" that are really effective for all possible browsers, and more maintenance is needed if there is an update or something like that in the third-party program version.

But overall you can check the registry to find the default browser, and then minimize the existing window here More details.

Another important point is that the product can be configured by the user to behave exactly in this undesired way (open always maximized), and you replace that behavior that the user configured can cause some complaints.

But if that's exactly what you want, you can use the following example:

IE

ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Minimized;

Process.Start(startInfo);

startInfo.Arguments = "http://www.google.com";

Process.Start(startInfo);
    
15.10.2018 / 14:43