启动应用程序,并将其发送给第二台显示器? [英] Launch an application and send it to second monitor?

查看:276
本文介绍了启动应用程序,并将其发送给第二台显示器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法通过流程在另一个屏幕开始/午餐计划?

Is there any way to start/lunch a program through Process in another screen?

有人问<一个href=\"http://stackoverflow.com/questions/797154/launch-an-application-and-send-it-to-second-monitor\">here但没有答案。

请注意:这是不是在我的应用形式,我问在另一个屏幕上运行一个外部程序

Note: it is not a form in my app, I'm asking about running an external program in another screen!

推荐答案

由于窗口是不是你的,你只能通过调用Windows API的移动。你将不得不这样做:

Since the window is not yours, you can only move it by invoking the Windows API. You will have to do this:


  • 启动过程。

  • Launch the process.

使用 FindWindow函数 检索句柄窗口。如果窗口不存在,这个过程并没有创造它尚未;睡500毫秒,然后再试一次。 (但是不要进入无限循环;停止,如果你不能找到一个合理的超时之后的窗口)

Use FindWindow to retrieve the handle to the window. If the window doesn’t exist yet, the process hasn’t created it yet; sleep for 500ms and then try again. (But don’t go into an infinite loop; stop if you can’t find the window after a reasonable timeout.)

使用<一个href=\"http://msdn.microsoft.com/en-us/library/ms633545%28VS.85%29.aspx\"><$c$c>SetWindowPos改变窗口的位置。

Use SetWindowPos to change the position of the window.

如果你不知道该窗口的标题,你不能使用 FindWindow函数。在这种情况下,

If you don’t know the title of the window, you can’t use FindWindow. In that case,


  • 启动过程,并通过检索 Process.Handle 获得进程句柄。

使用 EnumWindows的 检索所有窗口。对于每一个窗口,用<一个href=\"http://msdn.microsoft.com/en-us/library/ms633522%28VS.85%29.aspx\"><$c$c>GetWindowThreadProcessId检查它是否属于你的进程。如果没有窗口属于你的进程,等待和不断的尝试。

Use EnumWindows to retrieve all the windows. For each window, use GetWindowThreadProcessId to check whether it belongs to your process. If no window belongs to your process, wait and keep trying.

使用<一个href=\"http://msdn.microsoft.com/en-us/library/ms633545%28VS.85%29.aspx\"><$c$c>SetWindowPos改变窗口的位置。

Use SetWindowPos to change the position of the window.

当然,你可以使用 Screen.AllScreens [N] .WorkingArea 来获取你想要的屏幕的位置和大小,然后你就可以相对窗口的位置了这一点。

Of course, you can use Screen.AllScreens[n].WorkingArea to retrieve the position and size of the screen you want, and then you can position the window relative to that.

这篇关于启动应用程序,并将其发送给第二台显示器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆