[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Autohide the parent window

Posted on 2004-10-04
10
Medium Priority
?
246 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

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 …
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

656 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