6
我知道它使用GetForegroundWindow
功能,我可以得到当前活动窗口的句柄,但现在i want to detect when the active window (of any application) changes (become active)
。我想到的第一个解决方案是检测时,前台窗口改变
- 存储GetForegroundWindow函数返回的当前值(句柄)。
- 再次使用一个定时器组件检查由GetForegroundWindow返回,并与旧值比较值的。
我想知道如果存在一个更好的方式来做到这一点可能使用Windows消息或其他东西。
我记得有一招窃听到在Windows 3.x的一个窗口,消息队列,不知道这招仍然工作在Win32 – Johan 2011-05-03 21:59:18
我希望你不是想确保你的窗口始终在其他窗口之上。 http://blogs.msdn.com/b/oldnewthing/archive/2011/03/10/10138969.aspx – 2011-05-03 22:52:48
@Jim别担心,我没有那样做。 – Salvador 2011-05-04 21:33:58