[DUG] Sending notification between programs

Jolyon Smith jsmith at deltics.co.nz
Wed Aug 18 17:03:19 NZST 2010


My preferred answer, based on what you have told us, is in the question:

 

Use an "Event".

 

http://msdn.microsoft.com/en-us/library/ms682396(VS.85).aspx

 

One application creates the event, the other obtains a handle to the same
named event (whichever one starts first Creates it, the other Open's it, so
both apps have to deal with either getting first bite of the cherry or
coming runner up J)

 

The key is in the two apps agreeing on the name of the event object so that
they are referring to the same thing - I forget the details of achieving
this and leave that research as an exercise for the reader.  J

 

App B can then WaitFor on the event until app A signals it.

 

You may need a similar mechanism for communication of B's completion of
processing too.

 

 

Hope that helps.

 

From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On
Behalf Of John Bird
Sent: Wednesday, 18 August 2010 16:43
To: NZ Borland Developers Group - Delphi List
Subject: [DUG] Sending notification between programs

 

Which way would you favour to do the following ?

 

I have two Delphi programs (A and B) that I will pass data from A to B - I
will probably use  a file to put the data in because its quite structured.
B will sleep on a timer loop until this something is triggered.

 

What I want to do is send a simple notification from program A to B that
there is something to do - i.e. trigger an event in B to wake and do
something to process this.

 

There are various ways I could communicate this notification

 

1 - Has to add minimal overhead of size and processing to programs A and B

2 - A can tolerate B not responding immediately without freezing but
preferably will know

 

The ways I have considered to be candidates are

 

a - Windows messaging

b - TCP/IP Indy   (which could send the data too.  (adds complexity of needs
to be done in a thread to not affect the main program A)

c - make program B a DLL

d - Roll my own - make a timer in B which polls for for some condition and
otherwise continues to sleep

e - something else.

 

Kindly share your favoured options how you might do this.

 

John

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20100818/01b9ec11/attachment.html 


More information about the Delphi mailing list