如何将焦点设置到另一个窗口? [英] How to set focus to another window?
本文介绍了如何将焦点设置到另一个窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有失去焦点程序的问题。这不是我的计划。我怎么能写第二方案将焦点设置到该窗口每1-2秒?是有可能做到这一点?
I have a problem with a program that loses focus. It's not my program. How can I write a second program to set focus to that window every 1-2 seconds? Is is possible to do that?
推荐答案
如果你想带一些其他程序/流程<您可以使用下面的Win32 API / p>
You can use following Win32 API if you want to bring some other program/process
[DllImport("coredll.dll")]
static extern bool SetForegroundWindow (IntPtr hWnd);
private void BringToFront(Process pTemp)
{
SetForegroundWindow(pTemp.MainWindowHandle);
}
这篇关于如何将焦点设置到另一个窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文