dde入门问题(50分)

  • 主题发起人 主题发起人
  • 开始时间 开始时间

Unregistered / Unconfirmed
GUEST, unregistred user!
我想用dde完成一个应用程序内的对话,但对dde一无所知,不知该如何入手。[:)]
 
主意不错,可就是英文对不住全国人民。[:)]
 
告诉我邮箱, 给你发个例子
 
先谢过了。
 
发过去了, 你看看吧
 
打不开,
能否请你发到:新浪里。[:I]
aitn@sina.com
 
DDE已经是没落的技术了,建议换别的。
 
dde.zip
在我这里看不了。
 
换别的!?
 
服务程序
unit ddeserver;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, DdeMan, Buttons;

type
TForm1 = class(TForm)
ddesc: TDdeServerConv;
ddesi: TDdeServerItem;
Button2: TButton;
Edit1: TEdit;
Memo1: TMemo;
cccc: TBitBtn;
procedure Button2Click(Sender: TObject);
procedure ddesiPokeData(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;

procedure TForm1.ddesiPokeData(Sender: TObject);
var
i:integer;
begin
if ddesi.Lines.Count<>0 then
begin
i:=ddesi.Lines.Count-1;
memo1.Lines.Add(ddesi.Lines);
ddesi.Lines.Clear;
ddesi.Lines.Add(edit1.Text);
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
ddesi.Lines.Add(edit1.text);
memo1.Clear;
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
ddesi.Lines.Clear;
ddesi.Lines.add(edit1.text);
end;

end.

客户程序
unit ddeclient;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, DdeMan;

type
TForm1 = class(TForm)
Button1: TButton;
ddeci: TDdeClientItem;
ddecc: TDdeClientConv;
Edit1: TEdit;
Button2: TButton;
Button3: TButton;
Edit2: TEdit;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button2Click(Sender: TObject);
begin

close;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
aa:pchar;
begin
edit1.Text:='';
ddecc.SetLink('pddeserver','ddesc');
aa:=StrAlloc(255);
ddecc.OpenLink;
aa:=ddecc.RequestData('ddesi');
ddecc.CloseLink;
if aa<>nil then
edit1.Text:=strpas(aa);
StrDisPose(aa);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
ddecc.SetLink('pddeserver','ddesc');
// thedata := StrAlloc(79);
ddecc.OpenLink;
ddeci.Lines.Clear;
ddeci.Lines.Add(edit2.text);
ddecc.PokeDataLines(ddeci.DdeItem,ddeci.Lines);
ddecc.CloseLink;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
ddeci.DdeConv:=ddecc;
ddeci.DdeItem:='ddesi';
ddecc.ConnectMode:=ddeManual;
ddecc.DdeService:='pddeserver';
ddecc.DdeTopic:='ddesc';
ddecc.ServiceApplication:='';
end;

end.
 
后退
顶部