MDI operation on remaining child after on child closed?

I have a MDI app.  If I have 3 or more child windows open at a time, and a close one off the 3 open windows, I want the remaining windows to automatically retile.  A have a custom tile function in my CMainFrame and need to call it to reposition the remaining child windows.  If I call this from the child I am closing, I get an ASSERTION because the child the calls reposition, is destroyed.  I need to call this reposition AFTER the client is destroyed.  I imagine I do this from CMainFrame but can not figure it out.  All suggestions welcome and code samples greatly appreciated.
SurferAsked:
Who is Participating?
 
Roshan DavisConnect With a Mentor Commented:
Add this code in ur CChildFrame Destructor

((CMDIFrameWnd*)AfxGetMainWnd())->MDITile(MDITILE_VERTICAL);

GOOD LUCK

0
 
Roshan DavisCommented:
Check IsWindow(hWnd) before reposition

GOOD LUCK
0
 
SurferAuthor Commented:
How do I know when to check IsWindow()against my reposition, from CMainFrame?  Is there a member in CMainFrame that is called AFTER the Child is destroyed?
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
SurferAuthor Commented:
How do I know when to check IsWindow()against my reposition, from CMainFrame?  Is there a member in CMainFrame that is called AFTER the Child is destroyed?
0
 
SurferAuthor Commented:
How do I know when to check IsWindow()against my reposition, from CMainFrame?  Is there a member in CMainFrame that is called AFTER the Child is destroyed?
0
 
Roshan DavisCommented:
Try This

this is working , not to check IsWindow()

Add this code in ur CChildFrame Destructor

((CMDIFrameWnd*)AfxGetMainWnd())->MDITile(MDITILE_VERTICAL);

GOOD LUCK
0
 
SurferAuthor Commented:
That did the trick!
0
 
Vinayak KumbarSr Program ManagerCommented:
Hi,

Can U just post the code of how u r calling ur tile window function from child window? And if possible post the custom tile function also, so that we can get wher exactly it is crashing.

VinExpert
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.