From: MuMbi on
Hi, everybody.

I need to hide child frame in MDI app.

But, I will use document and view in the child frame.

So, I've got to hide the child frame with no destruction.

ShowWindow( SW_HIDE ) makes the child frame just minimize.

Is it possible to hide child frame in MDI app?

I need your helps.

Help me~

From: Ajay Kalra on
On Jan 31, 12:39 am, MuMbi <mu...(a)daum.net> wrote:
> Hi, everybody.
>
> I need to hide child frame in MDI app.
>
> But, I will use document and view in the child frame.
>
> So, I've got to hide the child frame with no destruction.
>
> ShowWindow( SW_HIDE ) makes the child frame just minimize.
>
> Is it possible to hide child frame in MDI app?
>
> I need your helps.
>
> Help me~

ShowWindow(SW_HIDE) should work(call it on child frame). Are you
certain you are calling the on the MDIChildWnd and and not on the
view?

--
Ajay
From: MuMbi on


"Ajay Kalra" wrote:

> On Jan 31, 12:39 am, MuMbi <mu...(a)daum.net> wrote:
> > Hi, everybody.
> >
> > I need to hide child frame in MDI app.
> >
> > But, I will use document and view in the child frame.
> >
> > So, I've got to hide the child frame with no destruction.
> >
> > ShowWindow( SW_HIDE ) makes the child frame just minimize.
> >
> > Is it possible to hide child frame in MDI app?
> >
> > I need your helps.
> >
> > Help me~
>
> ShowWindow(SW_HIDE) should work(call it on child frame). Are you
> certain you are calling the on the MDIChildWnd and and not on the
> view?
>
> --
> Ajay
> .
>

Oh;; thanks.

When i tried it, it happend like my first article.

After I read your article, I tried again on View::OnInitialUpdate.

Yes. The child frame hides successfully.

But the view in the child frame was shown on the background of main frame,

So I changed the view's parent to other pane.

It's successful.

But the background of main frame need to be redrawn.

Here, let me ask you for helps.

What window is the background of main frame?

How can I access the background of main frame?

thank for your helps.
From: Joseph M. Newcomer on
Se below...
On Sun, 31 Jan 2010 23:16:01 -0800, MuMbi <MuMbi(a)discussions.microsoft.com> wrote:

>
>
>"Ajay Kalra" wrote:
>
>> On Jan 31, 12:39 am, MuMbi <mu...(a)daum.net> wrote:
>> > Hi, everybody.
>> >
>> > I need to hide child frame in MDI app.
>> >
>> > But, I will use document and view in the child frame.
>> >
>> > So, I've got to hide the child frame with no destruction.
>> >
>> > ShowWindow( SW_HIDE ) makes the child frame just minimize.
>> >
>> > Is it possible to hide child frame in MDI app?
>> >
>> > I need your helps.
>> >
>> > Help me~
>>
>> ShowWindow(SW_HIDE) should work(call it on child frame). Are you
>> certain you are calling the on the MDIChildWnd and and not on the
>> view?
>>
>> --
>> Ajay
>> .
>>
>
>Oh;; thanks.
>
>When i tried it, it happend like my first article.
>
>After I read your article, I tried again on View::OnInitialUpdate.
>
>Yes. The child frame hides successfully.
>
>But the view in the child frame was shown on the background of main frame,
>
>So I changed the view's parent to other pane.
****
It is reasonably safe to assume in nearly every case that calling SetParent is a mistake.
There are some unbelievably rare situations in which makes sense. This does not appear to
be one of them.

If you ShowWindow(SW_HIDE) in OnInitialUpdate, you are hiding the wrong thing; you are
hiding the view window inside the child frame.
****
>
>It's successful.
>
>But the background of main frame need to be redrawn.
>
>Here, let me ask you for helps.
>
>What window is the background of main frame?
>
>How can I access the background of main frame?
>
****
The problems here stem from hiding the wrong window and then changing the parent. Neither
of these are a correct solution, so telling you how to solve the problem when the basic
approach is incorrect will not help.

Instead, you must hide the parent frame of the view. I typically prefer to do this by
creating a special child frame that implements user-defined messages, but you could simply
do GetParentFrame() on the view to obtain it. But in all cases you should make sure you
are hiding the window you intend to hide, not some other window. You should use Spy++ to
study what windows exist and their relationship to each other.
joe
****
>thank for your helps.
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Ajay Kalra on
On Feb 1, 2:16 am, MuMbi <Mu...(a)discussions.microsoft.com> wrote:
> After I read your article, I tried again on View::OnInitialUpdate.
>
> Yes. The child frame hides successfully.
>
> But the view in the child frame was shown on the background of main frame,
>
> So I changed the view's parent to other pane.
>
> It's successful.
>
> But the background of main frame need to be redrawn.
>
> Here, let me ask you for helps.
>
> What window is the background of main frame?
>
> How can I access the background of main frame?
>
> thank for your helps.

You are doing something wrong here. Its not this complicated. You
shouldnt have to change the parent of view to do this. GetParentFrame
from view will get you to its parent cframewnd. You need to simply
hide this after view has been attached to it.


--
Ajay