<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML lang=en><HEAD><TITLE></TITLE>
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META content=text/css http-equiv=Content-Style-Type>
<META name=GENERATOR content="MSHTML 8.00.7600.16625"></HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px"
id=MailContainerBody leftMargin=0 topMargin=0 CanvasTabStop="true"
name="Compose message area">
<DIV><FONT size=2 face=Arial>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.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>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.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Slight aside:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>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:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>B in a timer monitors the foreground window
title bar of A</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>P:array[0..256] of Char;<BR></FONT></DIV>
<DIV><FONT size=2 face=Arial>
GetWindowText(GetForeGroundWindow,p,256);<BR> ATNowNewTitle :=
p;</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>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.)</DIV>
<DIV><BR></DIV></FONT>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>John</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><B>From:</B> <A title=graham@wk.planet.gen.nz
href="mailto:graham@wk.planet.gen.nz">Graham Marsden</A> </DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV style="BACKGROUND: #f5f5f5">
<DIV><B>Sent:</B> Wednesday, August 18, 2010 7:54 PM</DIV>
<DIV><B>To:</B> <A
title="mailto:delphi@delphi.org.nz CTRL + Click to follow link"
href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</A> </DIV>
<DIV><B>Subject:</B> [DUG] Sending notification between
programs</DIV></DIV></DIV>
<DIV><BR></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN style="FONT-SIZE: 10pt">Keep it
simple .....</SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN
style="FONT-SIZE: 10pt"><BR></SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN style="FONT-SIZE: 10pt"><I>.....
will pass data from A to B - I will probably </I><B><I>use a file to put the
data in</I></B><I> because its quite structured.</I></SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN style="FONT-SIZE: 10pt"><I>B will
sleep on a timer loop until this something is triggered.</I></SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN
style="FONT-SIZE: 10pt"><I><BR></I></SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN style="FONT-SIZE: 10pt">Why not
use the exis the very existance of the data transfer file as the
trigger.</SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN
style="FONT-SIZE: 10pt"><BR></SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN style="FONT-SIZE: 10pt">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.</SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN
style="FONT-SIZE: 10pt"><BR></SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN style="FONT-SIZE: 10pt">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.</SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN
style="FONT-SIZE: 10pt"><BR></SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN style="FONT-SIZE: 10pt">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.</SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN
style="FONT-SIZE: 10pt"><BR></SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN style="FONT-SIZE: 10pt">Using this
method A and B don't even have to be on the same machine.</SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN
style="FONT-SIZE: 10pt"><BR></SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN style="FONT-SIZE: 10pt">Hope this
helps.</SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN
style="FONT-SIZE: 10pt"><BR></SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN style="FONT-SIZE: 10pt">Graham
Marsden</SPAN></FONT></DIV>
<DIV align=left><FONT size=2 face=Arial><SPAN
style="FONT-SIZE: 10pt"><BR></SPAN></FONT></DIV>
<DIV align=left></DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>NZ Borland Developers
Group - Delphi mailing list<BR>Post: delphi@delphi.org.nz<BR>Admin:
http://delphi.org.nz/mailman/listinfo/delphi<BR>Unsubscribe: send an email to
delphi-request@delphi.org.nz with Subject: unsubscribe</BODY></HTML>