Focus problem!
-
Dear All, I am developing an applicaton in windows2000 using MFC VC++6.0 Can you suggest a way out in the following matter: I have a dialog application A which calls another dialog application B on click of the button. Once the dialog window of B is created the application b is activated ,but I want to bring back the focus on the previous application window.(i want to activate the app a once the b is created) i.e MFC App A ----> Click of button --CALLS---> Another MFC App B (Both are in running state, but the focus gets shifted to application B) Do let me know if you need futher clarification of the question. Regards, Rohit
-
Dear All, I am developing an applicaton in windows2000 using MFC VC++6.0 Can you suggest a way out in the following matter: I have a dialog application A which calls another dialog application B on click of the button. Once the dialog window of B is created the application b is activated ,but I want to bring back the focus on the previous application window.(i want to activate the app a once the b is created) i.e MFC App A ----> Click of button --CALLS---> Another MFC App B (Both are in running state, but the focus gets shifted to application B) Do let me know if you need futher clarification of the question. Regards, Rohit
Use WM_SETFOCUS Windows message. Send it from app B's window to app A's window. Unfortunately, as you use two seperate applications, they cannot converse by regular pointer-means. You need to search for the dialog window and grant it focus. You could, alternatively, start the app B as minimized. This can be specified by the
STARTUPINFO
structure of theCreateProcess
call. If it is started up as minimized, it doesn't get the focus. Then, you can create a seperate function into app A that will show and activate B's window as needed. SeeCreateProcess
in MSDN for more information. -Antti Keskinen ---------------------------------------------- The definition of impossible is strictly dependant on what we think is possible.