1. [BUG Backgroud]
- 使用
SetForegroundWindow(hwnd)
不能将目标窗口弹到顶端. - Win7 中使用WIN键后出现的BUG.
最终成功测试代码:
BOOL MyClass::PutMyWindowToTop(
) {
OutputDebugString("In function PutMyWindowToTop!");
HWND hwnd = FindWindow(NULL, L"MyWindow");
if (hwnd == NULL) {
OutputDebugString("Failed to get hwnd of MyWindow!");
return FALSE;
} else {
OutputDebugString("Success get hwnd of MyWindow before switch to window");
}
if (!::IsWindow(hwnd)) {
OutputDebugString("hwnd is not a valid window's handler!");
return FALSE;
}
try {
DWORD lock_timeout = 0;
DWORD lock_timeout_after = 0;
HWND current_hwnd = ::GetForegroundWindow();
DWORD dw_this_tid