Solved

Autohide the parent window

Posted on 2004-10-04
10
214 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 84
Pressing cancel button with C# UI Automation 3 51
How to know only "File created" with EventLog 3 32
fix34  challenge 9 104
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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.

911 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

18 Experts available now in Live!

Get 1:1 Help Now