• Advertisement


This topic is now archived and is closed to further replies.

CFrameWnd is being stubborn

This topic is 5539 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a dialog-based MFC application that creates several CFrameWnd-derived classes dynamically during execution. My only complaint is that these windows always hog the foreground! In other words, they always stay on top of all the other windows of the application, always. I know CFrameWnd is supposed to be meant as a top-level window, but shouldn''t there be some way to force it to the background? I''ve tried SetWindowPos on both the offending window to get it to go back and the dialog to get it to move to the front, but to no avail. Does anyone know of any other ways to force CFrameWnd-derived windows to the back? "Yield, damn you, yield!"

Share this post

Link to post
Share on other sites
are you using WS_OVERLAPPEDWINDOW or WS_OVERLAPPED in your create function if so you might want to try removing them or try using CWnd::ShowWindow() or you might want to look at this code snippet that i used to tile a cview window and a form window
void CMainFrame::CreateOrActivateFrame(CDocTemplate* pTemplate,
CRuntimeClass* pViewClass)
{ TRACE("Entering CMainFrame::CreateOrActivateFrame\n");
CMDIChildWnd* pMDIActive = MDIGetActive();
CDocument* pDoc = pMDIActive->GetActiveDocument();

CView* pView;
POSITION pos = pDoc->GetFirstViewPosition();
while (pos != NULL)
pView = pDoc->GetNextView(pos);
if (pView->IsKindOf(pViewClass))

CMDIChildWnd* pNewFrame
= (CMDIChildWnd*)(pTemplate->CreateNewFrame(pDoc, NULL));
if (pNewFrame == NULL)
return; // not created
pTemplate->InitialUpdateFrame(pNewFrame, pDoc);

[edited by - j stoll on December 25, 2002 10:58:31 PM]

Share this post

Link to post
Share on other sites

  • Advertisement