[DUG] Sending notification between programs

Leigh Wanstead leighw at Softtech.co.nz
Thu Aug 19 10:04:31 NZST 2010


If you runs the applications on different site, I will use email :)

Have a nice day

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

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<mailto:graham at wk.planet.gen.nz>
Sent: Wednesday, August 18, 2010 7:54 PM
To: delphi at delphi.org.nz<mailto:delphi at 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 at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20100819/ccb8827d/attachment-0001.html 


More information about the Delphi mailing list