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