views:

1207

answers:

6

Is it possible to create an "application group" which would run under one window, but in separate processes, like in Chrome browser? I'd like to divide one application into multiple parts, so that one crashing or jamming process cannot take down others, but still keep the look and feel as close to original system as possible.

I know the Chrome source is available, but is there anything even half ready made for Delphi?

A: 

You can separate your application logic and execute it in several threads. That way, if one part of your application logic hangs up, you still have a responsive application. But you won't be able to put the GUI in multiple threads. The VCL requires you to execute all GUI related stuff in the main thread.

Smasher
Thank you for suggestion, but I'm using some ActiveX components which need to run in main thread.
Harriv
+3  A: 
RRUZ
Do those frameworks support out-of-process GUI plugins?
Lars Truijens
Thanks, but I'm really looking for multiprocessing, not plugin architecture.
Harriv
Lars, a proposal to use Plugins is an alternative to the submitted to in question, due to the high complexity involved in developing a system "like Chrome application" because "Google Chrome" implements a multi-process architecture has besides sandboxing,process administration, rendering isolated (the renderer), and many more.
RRUZ
+6  A: 

I guess basically you would create multiple processes each of which creates a window/form. One of the processes has the master window in which every child window is embedded. That is as simple as calling SetParent. The windows in different processes would talk to each other using an IPC (Inter Process Communication) mechanism like named pipes or window messages.

See this question for an embedding example of using SetParent in Delphi. See this question for an example of using named pipes in Delphi.

Lars Truijens
+5  A: 
Wouter van Nifterick
Interesting. It uses shared memory mapped files for IPC. See http://heidisql.googlecode.com/svn/trunk/source/synchronization.pas
Lars Truijens
And WM_COPYDATA in http://heidisql.googlecode.com/svn/trunk/source/communication.pas
Lars Truijens
+1 this is a great application . wich uses a schema based in mutex y Critical sections.
RRUZ
A: 

I am not sure about how Delphi operates but the standard procedure for multiprocess programming is forking.

You fork a new process with whatever code you want. Pass information to the forked process and let it run doing whatever it wants.

Can't explain multiprocess programming in one thread response. But look it up.

Dmitriy Likhten
-1. Since *fork* is a Unix term, I assume you mean it in the generic sense of "starting another process." In that case, you answer is, "multiprocess programming is starting multiple processes," which is an unhelpful tautology. Also, "look it up" is never a helpful answer. Please either explain how multiprocess programming works or provide links (with summaries).
Rob Kennedy
+3  A: 

Have a look at : http://blogs.microsoft.co.il/blogs/maxim/archive/2008/09/23/curiosity-killed-the-programmer-multiprocess-browser.aspx . The source of the app is in CSharp. I'm sure you can adapt it to Delphi.

TwinForms
Nice. Uses SetParent for embedding and .Net Remoting for IPC
Lars Truijens