Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to start an instance of an application inside another program Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
04-Oct-02
Category
System
Language
Delphi 2.x
Views
159
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			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.

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC