I had thought of something just like this, having something in the data being 
what B looks for and acts on, otherwise sleeps.   However this makes it disk 
based, and B has to poll.  I was hoping something simple in memory could wake 
up B rather than referring to the filesystem.

The main disadvantage of using one of the approaches mentioned is that there is 
two things that have to work right for the communication, two things could 
break.

Slight aside:

You know there is one really cunning way to get A to signal to B that I have 
used in the past that involves sending nothing at all:

B in a timer monitors the foreground window title bar of A

P:array[0..256] of Char;

  GetWindowText(GetForeGroundWindow,p,256);
  ATNowNewTitle := p;

then searches for certain text in it, if its there its a signal to do 
something.    This assumes A has focus which worked fine in my case.    I used 
it to automatically suspend an automated time logging whenever the reporting 
program for said logging was in focus, as it was likely to be searching the 
same data file.    It was spooky how well that worked!  (Every time the report 
program lost focus or closed the time logging resumed.)



John

From: Graham Marsden 
Sent: Wednesday, August 18, 2010 7:54 PM
To: delphi@delphi.org.nz 
Subject: [DUG] Sending notification between programs


Keep it simple .....


...... 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.


Why not use the exis the very existance of the data transfer file as the 
trigger.


Program A creates the file(s) with the data and then goes on with whatever else 
it needs to do. Perhaps even creating another data file or appending to an 
existing one.


Program B sleeps on a timer, wakes up, checks for the existance of a/the data 
file(s). If one/some exist then process, if not then sleep another cycle.


I have use this method to pass both fax and email files and other messages to a 
"server". Naming conventions, folder locations etc can all be used to do any 
segregation of users/purposes as required.


Using this method A and B don't even have to be on the same machine.


Hope this helps.


Graham Marsden




--------------------------------------------------------------------------------


_______________________________________________
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

Reply via email to