What is the best and easiest way to send a string from one instance of my program to another instance of my program? The receiving program has to execute a procedure, using the received string as a parameter.
I started reading about DDE but I got confused. What other options do I have, and what is the easiest way to implement this?
Use named Pipes, but I would recommend Russell Libby’s named Pipe components. There is a TPipeClient and TPipeServer component.
As of (2013-10-04) Francoise Piette and arno.garrels@gmx.de updated this source code to compile with Delphi 7 to XE5 (earlier versions may compile however untested) and put it here: http://www.overbyte.be/frame_index.html?redirTo=/blog_source_code.html
These 2 components make using named pipes incredibly easy, and named pipes are great for inter-process communication (IPC).
His website is here. Look for ‘Pipes.zip’. The description from the source is: // Description : Set of client and server named pipe components for Delphi, as // well a console pipe redirection component.
Also, Russell helped me out on Experts-Exchange with using an older version of this component to work in a console app to send/receive messages over named pipes. This may help as a guide in getting you up and running with using his components. Please note, that in a VCL app or service, you don’t need to write your own message loop as I did in this console app.