views:

303

answers:

5

I have four small single-form utility applications that I have written in Delphi (Win32), that every once in awhile I want to use in a way that makes them "feel" as if they are all one application, mostly to make switching back and forth between them super-easy. It would be great, for instance, to be able to insert them as containers inside a TabSheet, or something along those lines.

AppControls makes a neat little component that does something similar with TForm descendents, allowing them to be inserted inside another container in a Delphi application (see acEmbeddedForm http://www.appcontrols.com/appcontrols/overview.html'>here ), but I don't see any way to do this with four separate applications unless I build a fifth application with this end result in mind, and compile in all the forms of the original four applications.

I could also imagine wanting to "contain" or embed some other application as well (say, for instance, Notepad).

Is this possible in Delphi? (all things are possible... <g>)... and if so, would it be super difficult, and require massive amounts of under-the-hood Windows API familiarity?

I'm thinking the respective answers to these are probably yes, and yes, but hoping the answers are yes, and no. Thought I would ask just to be sure. <g>


If I am dreaming here from a programming perspective, and this is way more work than it's worth; any recommendations for utilities that make switching back and forth between a standard set of three or four applications simpler than it normally is in Windows?

+5  A: 

You could make your small apps into OLE servers and create a new application that hosts them in one main form. OLE is nicely supported by Delphi, so it should be both fairly easy and not require much API fiddling.

mghie
+1  A: 

With regards to embedding programs you don't have control over: I suspect you'll have a lot of trouble trying to do what you're describing, and if it's even possible at all (something I doubt), it would rely on a lot of low-level API calls and general nastiness.

If you wanted to restructure your application somewhat, you could make your four programs into plugins, and create a fifth "host" application that could load any or all of them.

I suggest you take a look at the JEDI plugin system, available for free from http://delphi-jedi.org.

Tim Sullivan
A: 

Since all of your other apps are single form, you could cut/paste/save all components in each app onto a separate "background" panel saved as a Component Template. Then you could load your Component Template onto its own PageControl/Tab.

Bob S
+3  A: 

This other SO question could provide some hints. Basically it states that you use SetParent. You could also enumerate over existing windows (such as notepad.exe) using FindWindow and call SetParent on them to reparent under your own.

Erich Mirabal
+1  A: 

I went with the "make a fifth app" solution when I combined a number of internal apps into a single app with tabs to select between them.

frmShipRef := TfrmShipRef.Create(self);
frmShipRef.Parent := tabShipRef;
frmShipRef.BorderStyle := bsNone;
frmShipRef.Align := alClient;
frmShipRef.Show;

I just set up a new form with tabs, then create each other form with the code above. This has worked well, and with a little conditional compiling I was able to add a panel on the left which provides a sort of "meta-copy-and-paste" to allow them to pass data between themselves.

mj2008
Thanks for the tips (and code!). : ) I may end up going that route for now, we'll see.
Jamo