Solved

Autohide the parent window

Posted on 2004-10-04
10
203 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
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now