xoz
asked on
How do I use DDE with Delphi 2 ?
How do I send a text from a client to a server?
I can't get it to work.
Do I need both the conv and item thing?
Can you give me a source for a button on the server, that when clicked send a text line to the client, and a source for a button on the client which gets the text and puts it in an edit box?
I can't get it to work.
Do I need both the conv and item thing?
Can you give me a source for a button on the server, that when clicked send a text line to the client, and a source for a button on the client which gets the text and puts it in an edit box?
ASKER
Thanks.
I'm waiting for an example of a Dephi application as a server.
How should I use the SetLink then ?
How do I pass text and not a macro?
BTW: Are you from Israel? Me too...
I'm waiting for an example of a Dephi application as a server.
How should I use the SetLink then ?
How do I pass text and not a macro?
BTW: Are you from Israel? Me too...
Yes I am.
To pass a text use pokedata. You will get the answer for the server tomorrow.
To pass a text use pokedata. You will get the answer for the server tomorrow.
ASKER
This is my client's source:
------------------------
procedure TForm1.Button1Click(Sender : TObject);
begin
DDEClientItem1.DDEConv := DDEClientConv1;
with DdeClientConv1 do
begin
ConnectMode := ddeManual;
DdeService := 'ddesproj';
ServiceApplication := 'ddesproj';
DdeTopic := 'DDEServerConv1';
if SetLink('ddesproj','DDESer verConv1') then
MessageDlg('Link Established.', mtInformation, [mbOK],0);
OpenLink;
end;
end;
procedure TForm1.Button2Click(Sender : TObject);
begin
Edit1.Text:=DdeClientItem1 .Text;
end;
procedure TForm1.Button3Click(Sender : TObject);
begin
DdeClientConv1.CloseLink;
end;
procedure TForm1.DdeClientItem1Chang e(Sender: TObject);
begin
Edit1.Text:=DdeClientItem1 .Text;
end;
This is my server's source:
--------------------------
procedure TForm1.Button1Click(Sender : TObject);
begin
DdeServerItem1.ServerConv := DdeServerConv1;
DdeServerItem1.Text := 'abcde';
end;
When I run the client and press button1 the link is established, and if the server is not
running, the client runs it.
Then I press button1 on the server, and expect the edit1.text in the client to change,
becuase of the DdeClientItem1Change procedure, but it doesn't.
If I try pressing button2 on the client edit1.text just turns empty...
Maybe my problem has to do with DdeclientItem1.DdeItem what should I set it to ?
The help is very unclear about it.
Thanks,
Yogev ascalar@netvision.net.il
------------------------
procedure TForm1.Button1Click(Sender
begin
DDEClientItem1.DDEConv := DDEClientConv1;
with DdeClientConv1 do
begin
ConnectMode := ddeManual;
DdeService := 'ddesproj';
ServiceApplication := 'ddesproj';
DdeTopic := 'DDEServerConv1';
if SetLink('ddesproj','DDESer
MessageDlg('Link Established.', mtInformation, [mbOK],0);
OpenLink;
end;
end;
procedure TForm1.Button2Click(Sender
begin
Edit1.Text:=DdeClientItem1
end;
procedure TForm1.Button3Click(Sender
begin
DdeClientConv1.CloseLink;
end;
procedure TForm1.DdeClientItem1Chang
begin
Edit1.Text:=DdeClientItem1
end;
This is my server's source:
--------------------------
procedure TForm1.Button1Click(Sender
begin
DdeServerItem1.ServerConv := DdeServerConv1;
DdeServerItem1.Text := 'abcde';
end;
When I run the client and press button1 the link is established, and if the server is not
running, the client runs it.
Then I press button1 on the server, and expect the edit1.text in the client to change,
becuase of the DdeClientItem1Change procedure, but it doesn't.
If I try pressing button2 on the client edit1.text just turns empty...
Maybe my problem has to do with DdeclientItem1.DdeItem what should I set it to ?
The help is very unclear about it.
Thanks,
Yogev ascalar@netvision.net.il
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, I'll try it now.
I wanted to send text from the server to client, I'll try to chnage your code to do so.
I've got Delphi 2, there's no demo example for the DDE there, and the documentation and help about the DDE is very bad.
I wanted to send text from the server to client, I'll try to chnage your code to do so.
I've got Delphi 2, there's no demo example for the DDE there, and the documentation and help about the DDE is very bad.
Hey, that makes us 3 Israelis on Delphi experts list...
pro...thanks for sharing this..
can i transfer a TObject or TRecord to there?
uses ddeman;
procedure TForm1.Button1Click(Sender
var
DdeClientConv1: TDdeClientConv;
DdeClientItem1: TDdeClientItem;
Buf: PChar;
begin
DdeClientConv1:=TDdeClient
DdeClientItem1:=TDdeClient
DDEClientItem1.DDEConv := DDEClientConv1;
GetMem(Buf,100);
Buf[0]:=#0;
with DdeClientConv1 do
begin
ConnectMode := ddeManual;
SetLink('WinWord','System'
OpenLink;
StrCat(Buf,'[FileNewDefaul
ExecuteMacro(Buf,False);
CloseLink;
end;
FreeMem(Buf,100);
DDEClientItem1.Free;
DdeClientConv1.Free;
end;