title: How do I create an MDI child window from a Delphi 5 ActiveX dll, and embed it in a Delphi XE MDI parent?
body: <p>Is there a way to create an MDI child window from an ActiveX dll written in Delphi 5, and to embed it in a MDI parent window created from a Delphi XE windows client application? If not, is there a way to mimic the behavior?</p>
  
  <p>Background</p>
  
  <p>There is an application written entirely in Delphi 5. The main form of the application is an MDI parent window. All other forms in the application are MDI child forms, and every one of them is created from an ActiveX library. The parent application creates the ActiveX, after which is calls a method of the ActiveX interface. From this method a form is created and it's FormStyle is set to fsMDIChild. At this point the form is an MDI child of the MDI parent. This works because both the application and the ActiveX libraries are compiled using runtime packages. As a result, all forms share the same instance of TApplication.</p>
  
  <p>The Problem</p>
  
  <p>The application is very large, and needs to be migrated to Delphi 2010 or Delphi XE. It would be fantastic if the application could be migrated systematically, by first migrating the application, and then migrating the ActiveX libraries one at a time (there are about 50 of them). </p>
  
  <p>The problem is that if the console application is compiled in XE, it will no longer be using the same TApplication instance as those libraries still compiled in Delphi 5.</p>
  
  <p>Even if the forms in the ActiveX library cannot be true MDI child windows, it seems like I should be able to return the handle of the form that is created from the ActiveX and grab it from the main form and make the form appear to be an MDI child. I could then create my own layer for handling events.</p>
  
  <p>Any ideas?</p>
  
  <hr>
  
  <p>Update: The approach currently being taken with this application is that it is being migrated from MDI to an SDI interface. It is perfectly possible to instantiate TForms from a Delphi 5 ActiveX DLL from a Delphi XE application, so long as the first form from each DLL can take care of it's own data (loading, saving, displaying additional forms, etc). The problem was in keeping the original MDI design. If the SDI design proves acceptable, there will be no need for an MDI solution. Still, if someone knows how to accomplish the MDI solution, I'd like to know.</p>