Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a Delphi app to 'host' another app

Status
Not open for further replies.

Minaki

Programmer
Aug 31, 2002
1
GB
Hello,

In a Delphi application I plan to write, I need to be able to make the application 'host' another program (existing, allready written app that can't be changed) in my programs memory location - and make the existing app run as another child window of my applications main form, if you see what I mean.

If possible, I also need my app to be able to access the existing applications memory, so it can moniter incoming events to that app, and also insert data into it.

I don't know the ins and outs of this, so it may not be clear - let me know if you need me to clarify anything.

Does anybody know how I would go about starting this? I have absolutly no idea where to begin.

Thanks,

Minaki
 
In a Delphi application I plan to write, I need to be able to make the application 'host' another program (existing, allready written app that can't be changed) in my programs memory location - and make the existing app run as another child window of my applications main form, if you see what I mean.

I don't believe this is possible unleas the existing app is designed to do it (for example, as an OLE Automation server, and even then it wouldn't be in the same memory location).

You could simply launch the external app, getting a handle to the new process, then find it's main window handle, and try to change the ownership of that window to become a child to your program's main window. This may enable your main window to see the events passed by windows to the now-contained window, but delphi is designed to keep you from worrying about events.

I'm not sure Windows will let you change the other app's main window's ownership, though.
 
wgcs is right in some way. You can use SetParent function to make a window to become a child window of your form (that would look somewhat like an MDI). But to catch and handle messages passed to that appliction you'd need to set up a message filter (hook procedure placed in DLL). Once you have a message filter you can redirect them to your "host" app, handle them and pass back to "child" app. By the way Windows won't have anything against your changing the other app's main window's ownership.

--- markus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top