Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How do I Hide Child Views in a MDI Application?

Posted on 2003-03-12
2
Medium Priority
?
275 Views
Last Modified: 2013-11-20
I have a list of CViews which are Child windows.  I want to iterate over this list and HIDE (not close or destroy) each Child View in the list.  I can't get this to work. So far I have tried:

CMainFrame * pFrame = (CMainFrame *)::AfxGetMainWnd();
POSITION pos = m_lstViews.GetHeadPosition();
CView * pCurrentView = m_lstViews.GetNext(pos);

while (pCurrentView)
{
   pCurrentView->ShowWindow(SW_HIDE);
   pFrame->RecalcLayout();
   pCurrentView = (pos) ? m_lstViews.GetNext(pos) : NULL;
}

Any help would be great!
0
Comment
Question by:bcoffe2000
2 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 200 total points
ID: 8118735
You have to call View's GetParentFrame  and hide that window instead of the view like...

CMainFrame * pFrame = (CMainFrame *)::AfxGetMainWnd();
POSITION pos = m_lstViews.GetHeadPosition();
CView * pCurrentView = m_lstViews.GetNext(pos);

while (pCurrentView)
{
  //pCurrentView->ShowWindow(SW_HIDE);
  CFrameWnd *pFrameWnd = pCurrentView->GetParentFrame();
  pFrameWnd->ShowWindow(SW_HIDE);

  pFrame->RecalcLayout();
  pCurrentView = (pos) ? m_lstViews.GetNext(pos) : NULL;
}


Good Luck
0
 

Author Comment

by:bcoffe2000
ID: 8118805
THANK YOU!! I knew it had to be something to do with some Frame...I just couldn't figure it out. Thanks Again.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question