I know how to force a CDialog to always stay on top of all other windows in your program ... non-modal. As seen in the test method below (code), you do not create by using *.DoModal. I understand this.
void CMFCTestAApp::OnOpenNonModalDialog()
{
//dialogTest new_dialog;
//new_dialog.DoModal();
dialogTest* test_dialog = NULL;
test_dialog = new dialogTest();
if(test_dialog != NULL)
{
if(test_dialog->Create(IDD_TestA_DIALOG))
test_dialog->ShowWindow(SW_SHOWNORMAL);
}
}
However, I have been unsuccessful at doing the same with something which inherits from a CMultiDocTemplate/CFormView
Question: is there a way to keep a CFormView which is stuffed into a CMultiDocTemplate on the top (in the foreground ... like a non-modal CDialog behaves), even if that window is not the window which has focus. So in other words, i want classX, which inherits from CFormView to always stay in front of classY which inherits from CView.
Partial Success: I was able to achieve partial success. When classY's OnActivateView method was hit (this is the class/window which should be in the background), then, within its OnActivateView, i would loop through all the classX objects (the ones i want in front) and bring them to the front using classx->bringToTop(); This did work, however, there was a ridiculous amount of flickering going on ... I am guessing because (1) by time classY's OnActivateView is called, classY has already been brought to the front of all the classX objects AND because (2) OnActivateView doesn't just get called once but about six time (not sure why so many times) ... each object's OnActivateView gets called anytime Any other window gets activated (not just when window you care about gets activated).
Question: can anyone thing of a better way to implement this which i am missing or don't know about? I have already tried testing out the classx->SetWindowPos(&classx->wndTop,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE) but this did not have an affect. I am guessing i am using this in the wrong place or it is getting undone in another part of the code.