我所想到的两种方法:1 使用 Spy++ 看你所要的窗口的 class name, window name 然后 FindWindnow(); FindWindowEx();2 使用 GetForegroundWindow(); 得到 the window with which the user is currently working. /* GetForegroundWindow The GetForegroundWindow function returns a handle to the foreground window (the window with which the user is currently working). The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads. */ 使用 GetForegroundWindow()得到的是 calling thread 中的 主窗口??? //这点我今天要验证一下。
我用spy++取到了它的窗口类是paneClassDC.
CWnd *window = findwindow("paneClassDC",NULL);
你们看看有什么错吗?
窗口的标题一定要看准,一点都不能错哦
msdn上说不能取子窗口。要用findwindowex()才能取到
我先用findwindow()取到powerpoint的窗口,不爽啊!
再用findwindowex()来取播放的窗口。
结果是非法操作。
然后 FindWindnow();
FindWindowEx();2 使用 GetForegroundWindow(); 得到
the window with which the user is currently working.
/*
GetForegroundWindow
The GetForegroundWindow function returns a handle to the foreground window (the window with which the user is currently working). The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads.
*/ 使用 GetForegroundWindow()得到的是 calling thread 中的 主窗口???
//这点我今天要验证一下。