Window focus problems
-
I have a dialog based app which is launching a process and then waiting for it to finish. The problem is that if I click on the parent window before the child process window displays then it seems to get the focus and is on top of the child window when it finally does display. How can I make it so that child window will always be displayed on top of the launching app's window? regardless of mouse clicks or anything else the user might do (I don't have access to the source code for the child process, so can't make any mods there)
-
I have a dialog based app which is launching a process and then waiting for it to finish. The problem is that if I click on the parent window before the child process window displays then it seems to get the focus and is on top of the child window when it finally does display. How can I make it so that child window will always be displayed on top of the launching app's window? regardless of mouse clicks or anything else the user might do (I don't have access to the source code for the child process, so can't make any mods there)
Make your child dialog as modeless and then add the following codes in your child dialog initDialog handler
CRect rect; // get the current window size and position GetWindowRect( rect ); // now change the size, position, and Z order // of the window. ::SetWindowPos( m\_hWnd , // handle to window HWND\_TOPMOST, // placement-order handle rect.left, // horizontal position rect.top, // vertical position rect.Width(), // width rect.Height(), // height SWP\_SHOWWINDOW // window-positioning options );
It basically set your child windows on top most in the z-order of the windows. Hope this helps. Sonork 100.41263:Anthony_Yio