Open a minimized browser in Windows Forms

Asked

Viewed 219 times

-1

I am making an application in Windows Forms and I have the following problem, when the user click a button of form, it will have to maximize a web page that is minimized, ie 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 wouldn’t be the point.

  • 1

    Take a look at this Soen question to see if it helps: https://stackoverflow.com/q/878429/8133067

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 be done with these arguments.

It is kind of complicated to find "gambiarras" that are really effective for all possible browsers, being necessary more maintenance if there is some update or something of the kind in the version of the third party program.

But in general it is possible to check the registry to find the default browser, and then minimize the existing window see here more details.

Another important point is that the product can be configured by the user to behave exactly this way unwanted (always open maximized) and, you replace this behavior that the user has set up 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);
  • Alvaro Alves I appreciate the attention but maybe I did not explain well, in the code you sent I start a new browser minimized. The goal is actually to maximize a browser that is minized and not open a new one...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.