Have a look at this ... communicating with messages. There may be more
elgant solutions, but if you "own" both applications (ie other programs
don't need to query interfaces etc) this is probably the best way to deal
with interprogram (same machine) coms.
Check out the TMessage type and be careful with your use of the Windows
constants ... but otherwise messaging between two programs can be pretty
straightforward.
RECEIVING PROGRAM
unit Unit1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
private
procedure WMDEBUG(var Msg:TMessage); message WM_USER+2000;
public
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WMDEBUG(var Msg:TMessage);
begin
label1.Caption := 'Received '+PString(Msg.lParam)^;
end;
end.
SENDING program:
uses WinCrt,WinTypes,Messages,WinProcs;
var
S : String;
begin
repeat
Readln(S);
SendMessage(HWND_BROADCAST,WM_USER+2000,0,Longint(@S));
until S='';
end.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 24 April 2001 11:46
To: Multiple recipients of list delphi
Subject: Re:[DUG]: Basic OO/Delphi Question
I may have the wrong end of the stick, as I am not totally sure what you are
after, but...
If FormX does not have the lable or caption, you cannot write code (in
FormX) to
modify the lable or caption that it does not know about.
Regarding the setting / Getting of a Property - you can write access methods
for
Properties, which if desired, you can override in descendant Forms. That
should
produce the desired effect.
Regards
Paul McKenzie
=========================
Paul McKenzie
Jetbet II Developer
=========================
[EMAIL PROTECTED]
Ph: (04) 576-6822
T.A.B. National Office
106-110 Jackson Street
Petone
New Zealand
____________________Reply Separator____________________
Subject: [DUG]: Basic OO/Delphi Question
Author: [EMAIL PROTECTED]
Date: 24/04/2001 11:32
I have a form FormX that I want to use in a number of projects.
In, say, Project A I have a form FormA with a label and caption.
When a change is made to some list or variable on FormX I want to
modify
the
FormA.label.caption
I don't want to do this by writing FormA.label.caption := 'Foo'; in my
FormX
unit
because that won't work when I want to do a similar thing from FormX to
FormB in ProjectB.
I know that being able to do this is the benefit of OO but I'm stuck in
my
procedural mindset.
I can make the value I change a property of FormX - but how does FormA
or
FormB know the property has changed?
I'm sure it's simple - just can't see it.
Ideas please.
TIA
Mike
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"(See attached file: att1.eml)
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"