如何从C#桌面应用程序以全屏模式打开默认浏览器?

时间:2022-11-21 07:36:57

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:

如何从C#桌面应用程序以全屏模式打开默认浏览器?我在SO上看过类似的问题:

How to open in default browser in C#

如何在C#中使用默认浏览器打开

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

。 。 。但是没有任何地址可以在C#的FULLSCREEN浏览器窗口中打开本地HTML文件(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?

但是如何将其默认为全屏?有没有办法模拟F11按键,甚至更直接的东西?

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. . .

编辑:理想情况下,我不需要打开表单。我不想混淆这个问题,但我正在试验Kinect语音识别引擎,并且会在系统托盘中运行一个程序,总是在听。我已经知道了,我可以说一个命令,它会。 。 。

//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??

因此,我无需在全屏和常规屏幕之间来回切换,只需全屏启动即可。我当时认为F11印刷机的模拟将是答案,但听起来我需要一个开放的表格?

Thanks!

Matt

2 个解决方案

#1


1  

For that you would need to use sendkeys

为此,您需要使用sendkeys

Looking at the list you need something like:

查看列表,您需要以下内容:

ActiveForm.SendKeys("{F11}");

Hope that solves your issue.

希望能解决你的问题。

#2


0  

wouldn't the SendKeys need to be

SendKeys不需要

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

instead of

ActiveForm.SendKeys("{F11}");

#1


1  

For that you would need to use sendkeys

为此,您需要使用sendkeys

Looking at the list you need something like:

查看列表,您需要以下内容:

ActiveForm.SendKeys("{F11}");

Hope that solves your issue.

希望能解决你的问题。

#2


0  

wouldn't the SendKeys need to be

SendKeys不需要

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

instead of

ActiveForm.SendKeys("{F11}");