You are supposed to loose focus of someone activates another window, this is the only valid behavior. You need to understand that there is only one focused window (child window, a control) per desktop.
However, if you think that the focus should get back to the previously focused control when a window is activated, you are absolutely right.
High-level UI libraries always take care of that, but MFC is not one of them. You can achieve this effect by handling windows message WM_ACTIVATE:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms646274%28v=vs.85%29.aspx[
^].
With MFC, you can use
CWin:OnActivate
:
https://msdn.microsoft.com/en-us/library/1f31c334.aspx[
^].
Congratulations with April 1st! :-)
I would like to use the occasion to invite your (and everyone else, of course) to see my new 1 of April publication and have some fun:
Some Programming Approaches to "Neuro-Linguistic Programming".
Participation in this game in Comments and Discussions is especially encouraged.
Thank you.
—SA