tags:

views:

332

answers:

3

I am working on an MDI application in Delphi.

I would like to show interactive views generated by other applications(which I also build) within MDI child windows of my application.

When the user selects a specific view type in my app it will start an instance of the other app which will generate one or more data views displayed in MDI child windows of my app.

I hope this is clear.

+1  A: 

You can spawn the other application, grab the window handle associated with that process, then set the Parent of that window handle to the handle associated with a form or panel in your MDI application.

Check out the following Win32 functions...

  • GetParent( hWnd )
  • SetParent( hWndChild, hWndNewParent )

You may also need...

  • SetWindowPos( hWnd, hWndInsertAfter, X, Y, cx, cy, uFlags )
  • SetWindowLong( hWnd, nIndex, dwNewLong );
  • GetWindowLong( hWnd, nIndex );
moobaa
A: 

If you want to modularize your application I think it's better to use a dll to define the forms.

For that you define the form class in the dll or dpk and after you load it from you application.

If you are working with MDI forms I suggest that you use normal empty MDI forms and show your dll forms inside taking out the borders, like this:

DllForm.FormStyle:=fsNormal;
DllForm.BorderStyle:=bsNone;
DllForm.Parent := MDIForm;
DllForm.Align := alClient;

You can find here an article about loading forms from a dll.

DaniCE
+1  A: 

Why not write an ActiveX control? It is designed for exactly this kind of work (consider, for example, how Outlook can use the Word text editor). Moreover, by going this route, your applications can interact with non-Delphi applications, as well. You'll be able to display non-Delphi applications, such as Word and Excel in your MDI window, and your applications will be able to show their contents in non-Delphi ActiveX hosts such as Word.

Craig Stuntz