WPF/MFC MDI interop – Crash when maximizing child frame of hosted MDI child window-Collection of common programming errors

I have an MFC MDI frame (CMDIFrameWnd-derived) that I am hosting inside a WPF shell application. CMainFrame uses the WM_CHILD style (I’ve unset the WM_CAPTION and FWS_ADDTOTITLE flags) and is parented to the WPF HwndHost.

Everything looks OK except that when I maximize a child frame I usually get an access violation somewhere around the child frame window’s CWnd::OnMDIActivate() method.

I assume the problem has to do with the CMainFrame no longer having a menu or caption or something.

My questions are really:

  1. Why might it be crashing? Is there a ‘correct’ way of making an MFC MDI app a child window?
  2. I can’t find much in the way of examples for my situation – has anyone else out there had experience WPF hosting an MFC MDI CMDIFrameWnd?

Thanks for any help