Author: Jonas Bilinkevicius 
Is there an easy way to start an instance of an application inside another 
application so it looks like it's MDI when its not. I have the sub-apps and they 
need to be able to be run seperately, but I would also like to create an 
application that runs them inside itself, kind of like Word running Excel.
Answer:
If you want to use the Office model (each application is a OLE document server that 
can be activated in an OLE container) be prepared for a lot of work. Writing OLE 
document servers is a major effort and the VCLs ActiveX framework will get you only 
partways to the goal.
For some reason one can get away with parenting a window in another process to a 
window in your own, via Windows.SetParent. It will then act somewhat like a child 
window.
1   
2   procedure TForm1.Button1Click(Sender: TObject);
3   var
4     wnd: HWND;
5   begin
6     WinExec('notepad.exe', sw_hide);
7     Sleep(500);
8     wnd := FindWindow('notepad', nil);
9     Windows.SetParent(wnd, handle);
10    SetWindowPos(wnd, 0, 0, 0, clientwidth, clientheight, SWP_NOZORDER or
11      SWP_SHOWWINDOW);
12  end;
You will probably need to implement some inter-app communication, e.g. based on WM_COPYDATA messages, between your applets. Depending on how far you need to go with the integration that may get you most of the way.
			
           |