?
Solved

Autohide the parent window

Posted on 2004-10-04
10
Medium Priority
?
249 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
  • 3
  • 2
  • 2
7 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 500 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month15 days, 19 hours left to enroll

850 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