GetForegroundWindow()api无法正常工作 [英] GetForegroundWindow() api not working properly
问题描述
大家好,
我们的Windows服务应用程序包含一个在每个用户会话上运行的exe。所有这些exes都是用VC ++,Visual Studio 2012开发的。在基于用户会话的exe上,我们试图使用GetForegroundWindow()
在机器中找到活动窗口,它在Windows 7,8.1,10上工作正常。基于用户会话的应用程序将每隔一小时重新启动一次。有时,应用程序在重新启动后会显示自己的进程ID,但焦点在于其他窗口。因此, GetForegroundWindow()是
当时无用
Hi All,
Our Windows service application contains one exe running on each user sessions. And all these exes are developed with VC++, Visual Studio 2012. On user session based exe we are trying to find the active window in a machine using GetForegroundWindow()
and it works fine on windows 7,8.1,10. The user session based application will restarts on every one hour period. Sometime the application shows its own process id after restart, but the focus is on some other window. So GetForegroundWindow() is
not useful at that time
任何人都可以建议任何其他方法来捕获上述方案的活动窗口。
Anyone can suggest any other method for capturing the active window for the above scenario.
提前致谢。
ANTU PHILIP
ANTU PHILIP
推荐答案
大家好,
我们的Windows服务应用程序包含一个在每个用户会话上运行的exe。所有这些exes都是用VC ++,Visual Studio 2012开发的。在基于用户会话的exe上,我们试图使用GetForegroundWindow()
在机器中找到活动窗口,它在Windows 7,8.1,10上工作正常。基于用户会话的应用程序将每隔一小时重新启动一次。有时,应用程序在重新启动后会显示自己的进程ID,但焦点在于其他窗口。因此, GetForegroundWindow()是
当时无用
Hi All,
Our Windows service application contains one exe running on each user sessions. And all these exes are developed with VC++, Visual Studio 2012. On user session based exe we are trying to find the active window in a machine using GetForegroundWindow() and it works fine on windows 7,8.1,10. The user session based application will restarts on every one hour period. Sometime the application shows its own process id after restart, but the focus is on some other window. So GetForegroundWindow() is not useful at that time
任何人都可以建议任何其他方法来捕获上述方案的活动窗口。
Anyone can suggest any other method for capturing the active window for the above scenario.
通过"活动窗口"准确定义您的意思。 对于哪个进程,您的还是其他进程?
Define exactly what you mean by "active window". For which process, yours or some other?
可能
GetLastActivePopup函数是你在找什么?
Maybe
GetLastActivePopup function is what you are looking for?
这篇关于GetForegroundWindow()api无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!