John, Hi. What you want to use is WinAPI: FindFirstChangeNotification, FindNextChangeNotification and FindCloseChangeNotification in program B. Essentially, A writes to a file, and renames it. This causes the handle returned by FindFirstChangeNotification to be signaled. You can test for this using a loop and WaitForSingleObject / WaitForMulitipleObjects. You can even specify a timeout in the WaitXXX calls so that B wakes periodically, even if there are nothing signaled. When the WaitXXX function returns, you can check for the existence of the file.
Regards, Dennis. -------------------------------------------------- From: "John Bird" <johnkb...@paradise.net.nz> Sent: Wednesday, August 18, 2010 4:43 PM To: "NZ Borland Developers Group - Delphi List" <delphi@delphi.org.nz> 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 > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: delphi@delphi.org.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: > unsubscribe _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe