2

Hi & thanks for looking!

How do I open default browser in fullscreen mode from a C# desktop application? I have seen similar questions on SO:

How to open in default browser in C#

. . .BUT nothing addresses opening a local HTML file (C: drive) in a FULLSCREEN browser window from C#.

I can open the window using this:

Process.Start("http://google.com");

But how do I make it default to fullscreen? Is there a way to simulate the F11 key press, or even something more direct?

EDIT: Ideally, I will not need to have a form open. I don't want to confuse the issue, but I am experimenting with the Kinect Speech Recognition engine and will have a program running in the system tray, always listening. I already have it to a point that I can say a command and it will. . .

//do stuff

. . .and in this case, I just want it to open the default browser in fullscreen mode.

So, I don't have to be able to toggle back and forth between fullscreen and regular screen, just launch in fullscreen. I was thinking that a simulation of the F11 press would be the answer, but it sounds like I need a form open for this??

Thanks!

Matt

Community
  • 1
  • 1
Matt Cashatt
  • 23,490
  • 28
  • 78
  • 111
  • 2
    There is no standard mechanism for this, every browser implement their "maximized with no frame" mode differently. ProcessStartInfo.WindowStyle is all you got. – Hans Passant Dec 27 '11 at 20:10
  • F11 appears to work for Chrome, Firefox and IE; while there's no clear standard this seems to get ~90% of popular browsers out there. – Jeremy McGee Dec 27 '11 at 20:17

2 Answers2

1

For that you would need to use sendkeys

Looking at the list you need something like:

ActiveForm.SendKeys("{F11}");

Hope that solves your issue.

H Bellamy
  • 22,405
  • 23
  • 76
  • 114
  • SendKeys requires a form handle and I'm guessing the default browser won't necessarily be a subform of his application. – M.Babcock Dec 27 '11 at 20:11
  • @M.Babcock for me, I find sendkeys does it for any activeform, for instance, you can use send keys to spam notepad after creating that process – H Bellamy Dec 27 '11 at 20:12
0

wouldn't the SendKeys need to be

ActiveForm.SendKeys.Send("{F11}"); 

instead of

ActiveForm.SendKeys("{F11}");
Hakan Fıstık
  • 16,800
  • 14
  • 110
  • 131
MethodMan
  • 18,625
  • 6
  • 34
  • 52