Hello all, I have an (unmanaged) GUI application. The top-level window has a number of child windows any of which may have the focus at any one time. If I alt tab away from the application and then back again the focus is always given to the top-level window, regardless of which child window had the focus when the app was left. I've tried saving the focused window at WM_ACTIVATEAPP (wParam==0) and restoring it at WM_ACTIVATEAPP (wParam!=0) but the focus is still later given to the top level window. A debug breakpoint on WM_SETFOCUS doesn't help because that is always called from GetMessage, so I can't see the callstack of what called SetFocus(). So, how do I restore focus whence it came when my application is made active? Thanks, /john
"JohnD" wrote: > I have an (unmanaged) GUI application. The top-level window has > a number of child windows any of which may have the focus at any > one time. > > If I alt tab away from the application and then back again the > focus is always given to the top-level window, regardless of > which child window had the focus when the app was left. This is very strange. I have never done anything special to maintain a focus in one of child windows. It happens automatically. You can test it with any application that contains child windows, for example, Windows Explorer. When you Alt+Tab between windows pay attention to the window in focus. It is always the same window that was before Window Explorer has lost input focus. Alex