Jump to content
IMG SPA

Return value from other application

Recommended Posts

Hello, I have 5 different programs that all use the same form.

My idea was to create an exe application with the shared form and handle the return result.
So I wanted to know if it is possible to receive the result from another application when it is closed and how to handle it

 

Thanks

Share this post


Link to post

I don't think this is a good idea. Just share the source code between your 5 different programs. Trying to setup inter process communication will complicate things massively, and probably needlessly. It will also be difficult to maintain the feel of this being one integrated app if you have multiple processes.

Share this post


Link to post

Do you want the exe with shared for to be launched by one application each time the application needs the form? It would be quite inefficient and you'll have to manage having several instances of the form hosting application. It is possible, but will be quite complex...

 

Instead, you can put the form inside a DLL that each application will load. Or even simpler, just compile the form's code into the 5 applications.

 

Share this post


Link to post
11 minutes ago, FPiette said:

Instead, you can put the form inside a DLL that each application will load.

Then you'll have two different instances of the VCL which is why packages exist.

Share this post


Link to post
50 minutes ago, IMG SPA said:

So I wanted to know if it is possible to receive the result from another application when it is closed and how to handle it

Yes, it is possible. If it is just a simple integer, you can return it in the process exit code and then retrieve it via GetExitCodeProcess(). But for anything more complex, you can create an Inter-Process Communication channel between the two apps, such as with a pipe, socket, shared memory, etc and exchange data that way.

Share this post


Link to post

You can share the form and the code a design time between the applications. But at runtime they are all isolated.

 

You can exchange data between them via the methods mentioned in the previous posts, but also with a database where every application put their results ... you are able to process all these informations like you want.

 

Bye

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×