Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Deleting all panes when Miniframe is Closing

17 views
Skip to first unread message

Psychoboy

unread,
Jan 4, 2010, 6:55:27 PM1/4/10
to
I have a CMDIFrameWndEx which I am handling OnCloseMiniFrame.

What I am doing now is doing:

CBasePane* pPane = dynamic_cast<CBasePane*>(pWnd->GetPane());
while(pPane != NULL)
{
pWnd->RemovePane(pPane);
pPane->DestroyWindow();
pPane = dynamic_cast<CBasePane*>(pWnd->GetPane());
}

to destroy all the panes within it when closed. I am dynamically
creating these panes. I want these panes gone when the Miniframe is
closed. This seems to work but I am worried this is not the proper way
to do it since GetPane() returns a CWnd* instead, thats why I am doing
the dynamic_cast. Is there a better way to iterate through all the
panes to destroy them?

Thanks.

AliR

unread,
Jan 5, 2010, 10:40:40 AM1/5/10
to
It really doesn't make a difference what GetPane returns, it is still a
pointer to your object that inherits from CWnd in one way or another. That
is what dynamic_cast is for.

So what you are doing works fine.

Are you deleting the object somewhere? I don't see a call to delete.

AliR.


"Psychoboy" <psyc...@gmail.com> wrote in message
news:d79ebdef-d0ce-4687...@q4g2000yqm.googlegroups.com...

Psychoboy

unread,
Jan 6, 2010, 10:27:57 AM1/6/10
to
It is deleting that is done in OnNcDestroy. I was just wondering if
there was a better way to iterate through the panes.

On Jan 5, 8:40 am, "AliR" <A...@online.nospam> wrote:
> It really doesn't make a difference what GetPane returns, it is still a
> pointer to your object that inherits from CWnd in one way or another.  That
> is what dynamic_cast is for.
>
> So what you are doing works fine.
>
> Are you deleting the object somewhere? I don't see a call to delete.
>
> AliR.
>

> "Psychoboy" <psyco...@gmail.com> wrote in message

0 new messages