How to set focus on the next window after minimizing ?
-
How can I set the focus to the next open window after I minimize some other window ? For example: I have the following apps open: IE, Word, Notepad When I minimize - Notepad is going to the task bar, At this point I lose the focus and the other open windows cannot be minimized (My program do minimize the current window in focus when I click something) This is what I tried: GetForegroundWindow()->ShowWindow(SW_SHOWMINIMIZED); Sleep(1000); // Let it minimize ? ::GetWindow(GetForegroundWindow()->m_hWnd, GW_HWNDNEXT); Any ideas ?
Best Regards - Yovav Gad CEO and founder of MicroMighty, Inc.
-
How can I set the focus to the next open window after I minimize some other window ? For example: I have the following apps open: IE, Word, Notepad When I minimize - Notepad is going to the task bar, At this point I lose the focus and the other open windows cannot be minimized (My program do minimize the current window in focus when I click something) This is what I tried: GetForegroundWindow()->ShowWindow(SW_SHOWMINIMIZED); Sleep(1000); // Let it minimize ? ::GetWindow(GetForegroundWindow()->m_hWnd, GW_HWNDNEXT); Any ideas ?
Best Regards - Yovav Gad CEO and founder of MicroMighty, Inc.
OK, I partially managed to do it with the following code: GetForegroundWindow()->ShowWindow(SW_SHOWMINIMIZED); CWnd* pCurrentWindow; POINT pt; GetCursorPos(&pt); pCurrentWindow = WindowFromPoint(pt); pCurrentWindow->SetForegroundWindow(); The problem is that it will only get the focus of windows behind the cursor (mouse) Any idea how to get the next window regardless to the cursor location ?
Best Regards - Yovav Gad CEO and founder of MicroMighty, Inc.
modified on Saturday, April 25, 2009 6:11 AM