Solved

Autohide the parent window

Posted on 2004-10-04
10
242 Views
Last Modified: 2013-11-20
hi all,
 Can any one tell me how to autohide the parent window ??I have an MDI application where when i move my mouse on the child window the parent window should hide....We can these effects in Windows Media player..Can any one tell me how to do it in a normal MFC application.....

thanx in advance
0
Comment
Question by:ArunaK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
10 Comments
 
LVL 11

Expert Comment

by:KurtVon
ID: 12217565
You cannot have a parent window do that.  The visibility of a parent window directly affects all child windows.

Since I'm still using WMP 7, I can't be sure, but I believe the trick Window Media player uses is to make the video window a sibling of the main window rather than a child.  It is also possible that it takes advantage of the WM_NCCALCSIZE message to change the size of the non-client areas to 0.

Hope this helps.
0
 

Author Comment

by:ArunaK
ID: 12223783
hi
Can u tell me whats the difference between sibling and child..see in MDI application the MDI View will be child of ur main frame..how can i change this??any idea abt how to achieve this????

Thanx in advance
Poorni
0
 
LVL 2

Expert Comment

by:raed_hasan
ID: 12225359
If you hide the main window, child windows are going to be hidden with it.
WMP is designed differntly than a normal MFC/MDI application. It probably
has two top level windows or simply one top level window with a owner drawn
Non-client area. Look at codeguru/codeproject for some skin applications and
search google.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ArunaK
ID: 12225639
hi,
 ya i have searched in those sites but couldnt find any related stuffs..Do u have an idea abt how to do it??


Thanx in advance
0
 
LVL 11

Accepted Solution

by:
KurtVon earned 125 total points
ID: 12226962
I'm not sure how an MDI app would do this, since you need a window to drag the MDI window in.  Basically, it cannot be an MDI app if the main window goes away.

I think you can use the SetParent function to set the parent window to the desktop when you want to hide the real main window, though.  I just did a quick test and

void CMditestDoc::OnToggleParent()
{
    static bool bParent = true;

    if (bParent)
    {
        CView* pView;
        CWnd* pChild;
        POSITION pos = GetFirstViewPosition();

        while (pos != NULL)
        {
            pView = GetNextView(pos);
            pChild = pView->GetParent();
            pChild->SetParent(NULL);
        }

        bParent = false;
    }
    else
    {
        CView* pView;
        CWnd* pChild;
        POSITION pos = GetFirstViewPosition();

        while (pos != NULL)
        {
            pView = GetNextView(pos);
            pChild = pView->GetParent();
            pChild->SetParent(AfxGetApp()->m_pMainWnd);
        }

        bParent = true;
    }
}

seems to work, though it throws an assertion periodically.
0
 

Author Comment

by:ArunaK
ID: 12236159
hi,
 Thanx for ur answers...
0
 
LVL 2

Expert Comment

by:raed_hasan
ID: 12236182
You should be able to find the skin examples at codeguru. I had looked at
them long time ago. But basically you will define regions of the window
making it a non-rectangular window. You can turn these regions to whatever
shape you want. Start with an elliptical window and see if you can make it
switch to rectangular and back.

Either way, you will be well advised to look at samples available at these
sites.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

729 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