JiiPee
2019-05-17 10:27:17 UTC
I have MFC frame window. Then on its client view I have child window and
the view it the parent of the child window (child window is a frame
based window). When I click the child windows title it gets activated
but the main frame window will not become topmost. I mean if the program
is under a notepad and then I click the childwindow (child of the view)
the program will not go in front of the notepad .. although the
childiwindow does get activated.
This works but it gives flicker (first main frame activated and then
focus back to child window):
(in child windows OnActivate):
OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
GetParentFrame()->BringWindowToTop(); // bring the main frame top
SetFocus(); // set focus back to child window frame
what is the right way to do this? This seems to work but
focus/activation goes first to mainframe which I want to prevent.
the view it the parent of the child window (child window is a frame
based window). When I click the child windows title it gets activated
but the main frame window will not become topmost. I mean if the program
is under a notepad and then I click the childwindow (child of the view)
the program will not go in front of the notepad .. although the
childiwindow does get activated.
This works but it gives flicker (first main frame activated and then
focus back to child window):
(in child windows OnActivate):
OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
GetParentFrame()->BringWindowToTop(); // bring the main frame top
SetFocus(); // set focus back to child window frame
what is the right way to do this? This seems to work but
focus/activation goes first to mainframe which I want to prevent.