DDE热连接的问题(100分)

  • 主题发起人 主题发起人 沈前卫
  • 开始时间 开始时间

沈前卫

Unregistered / Unconfirmed
GUEST, unregistred user!
我现在要编写一个与WinFIOL.exe进行DDE热连接数据交换.但现在有个问题:
用Delphi 3.0编写的程序在接收数据时,会漏掉一些数据或重复读取同一
数据.但用VB5.0编写的程序却不会出现此问题.请问这是为何?能不能将VB5.0
的DDE功能封装成一个OCX控件供Delphi调用?
编程环境:
硬件:Dell 233MHz.
软件:中文Windows95,Delphi 3.0.
WinFIOL.exe简介:
WinFIOL.exe是爱立信移动交换机终端所使用的软件.与之进行DDE热
连接后(DdeClientItem1.DdeItem:='Output"),其输出发生变化时
DdeClientItem1.OnChange事件会发生.
 
我认为丢失数据的问题还是你的程序中有问题

VB5作的OCX到Delphi或MS VC++中都不好使,只能在IE中使用
 
把程序代码贴出来看看可好?我很早以前搞过DDE,
那时用FPW2.5与VB3.0通讯,倒是没发现什么问题。
 
Delphi 3.0:
所有控件的属性均为默认值:

procedure TForm1.NewLink1Click(Sender: TObject);
begin
DdeClientConv1.SetLink('WinFIOL','Channel #2');
DdeClientItem1.DdeConv:=DdeClientConv1;
DdeClientItem1.DDeItem:='Output';
end;

procedure TForm1.DdeClientItem1Change(Sender: TObject);
begin
Memo1.Lines.Add(DdeClientItem1.Text);
end;

{
procedure TForm1.Button1Click(Sender:TObject);
begin
DdeClientConv1.SetLink('WinFIOL','Channel #2');
DdeClientItem1.DdeConv:=DdeClientConv1;
DdeClientItem1.DDeItem:='Output';
end;
}


程序输出:
<rlcrp:cell=dyg109a;



CELL BCCH CBCH SDCCH NOOFTCH
DYG109A 1 0 8 6

BPC CHANNEL CHRATE SPV STATE ICMBAND
2767 BCCH-34748 BUSY
2764 SDCCH-33919 IDLE 1
SDCCH-33918 IDLE 1
SDCCH-33917 IDLE 1
SDCCH-33916 IDLE 1
SDCCH-33915 IDLE 1
SDCCH-33914 IDLE 1
SDCCH-33913 IDLE 1
SDCCH-33912 IDLE 1
2761 TCH-6732 FR 1 IDLE 1
2760 TCH-6731 FR 1 BUSY 1
2759 TCH-6730 FR 1 BUSY 1
2758 TCH-6729 FR 1 BUSY 1
2757 TCH-6652 FR 1 IDLE 1
END
END




VB5.0:

所有控件的属性均为默认值:
MemoX为Delphi 3.0中的TMemo的OCX控件:

Private Sub Command1_Click()
Label1.LinkTopic = "WinFIOL|Channel #2"
Label1.LinkItem = "Output"
Label1.LinkMode = 1
End Sub

Private Sub Label1_Change()
MemoX1.Lines.Add (Label1.Caption)
End Sub

程序输出:

<rlcrp:cell=dyg109a;

CELL RESOURCES

CELL BCCH CBCH SDCCH NOOFTCH
DYG109A 1 0 8 6

BPC CHANNEL CHRATE SPV STATE ICMBAND
2767 BCCH-34748 BUSY
2764 SDCCH-33919 IDLE 1
SDCCH-33918 IDLE 1
SDCCH-33917 IDLE 1
SDCCH-33916 IDLE 1
SDCCH-33915 IDLE 1
SDCCH-33914 IDLE 1
SDCCH-33913 IDLE 1
SDCCH-33912 BUSY 1
2761 TCH-6732 FR 1 IDLE 1
2760 TCH-6731 FR 1 IDLE 1
2759 TCH-6730 FR 1 BUSY 1
2758 TCH-6729 FR 1 IDLE 1
2757 TCH-6652 FR 1 BUSY 1
2756 TCH-6651 FR 1 IDLE 1
END



WinFIOL.exe标准输出:

<rlcrp:cell=dyg109a;

CELL RESOURCES

CELL BCCH CBCH SDCCH NOOFTCH
DYG109A 1 0 8 6

BPC CHANNEL CHRATE SPV STATE ICMBAND
2767 BCCH-34748 BUSY
2764 SDCCH-33919 IDLE 1
SDCCH-33918 IDLE 1
SDCCH-33917 IDLE 1
SDCCH-33916 IDLE 1
SDCCH-33915 IDLE 1
SDCCH-33914 IDLE 1
SDCCH-33913 IDLE 1
SDCCH-33912 IDLE 1
2761 TCH-6732 FR 1 IDLE 1
2760 TCH-6731 FR 1 BUSY 1
2759 TCH-6730 FR 1 BUSY 1
2758 TCH-6729 FR 1 BUSY 1
2757 TCH-6652 FR 1 IDLE 1
2756 TCH-6651 FR 1 IDLE 1
END


注意:
WinFIOL.exe的技术文档中说: 结果是以一行一行的出的.并且
A hot-link with the "Output" data item causes WinFIOL
to send every line it receives from the target exchange
to the client application. A line received is only sent
to the client application if it institutes a whole line,
i.e. when it is terminated by a carriage return. This means
that if only a prompt is received from the target exchange,
it is not sent to the client application. Establish
an "Event" hot-link to obtain this information.
WinFIOL messages that start with "##", as in "## End of
include file '<file>'"
are also sent to the client application.

并且我还发现一个怪现象:如果进行热连接的代码放在
Button1Click(Sender:TObject)间的,在程序运行时点击
Button1按钮程序出现的并不是热连接,而是Cool-link.
用WinSight32.exe得到的是WinFIOL程序不断地发出
DDE数据,而我的程序却一点反应都没有.











 
(接上一次)

程序输出:
<rlcrp:cell=dyg109a;



CELL BCCH CBCH SDCCH NOOFTCH
DYG109A 1 0 8 6

BPC CHANNEL CHRATE SPV STATE ICMBAND
2767 BCCH-34748 BUSY
2764 SDCCH-33919 IDLE 1
SDCCH-33918 IDLE 1
SDCCH-33917 IDLE 1
SDCCH-33916 IDLE 1
SDCCH-33915 IDLE 1
SDCCH-33914 IDLE 1
SDCCH-33913 IDLE 1
SDCCH-33912 IDLE 1
2761 TCH-6732 FR 1 IDLE 1
2760 TCH-6731 FR 1 BUSY 1
2759 TCH-6730 FR 1 BUSY 1
2758 TCH-6729 FR 1 BUSY 1
2757 TCH-6652 FR 1 IDLE 1
END
END


 
WinFIOL.exe标准输出:
<rlcrp:cell=dyg109a;

CELL RESOURCES

CELL BCCH CBCH SDCCH NOOFTCH
DYG109A 1 0 8 6

BPC CHANNEL CHRATE SPV STATE ICMBAND
2767 BCCH-34748 BUSY
2764 SDCCH-33919 IDLE 1
SDCCH-33918 IDLE 1
SDCCH-33917 IDLE 1
SDCCH-33916 IDLE 1
SDCCH-33915 IDLE 1
SDCCH-33914 IDLE 1
SDCCH-33913 IDLE 1
SDCCH-33912 IDLE 1
2761 TCH-6732 FR 1 IDLE 1
2760 TCH-6731 FR 1 BUSY 1
2759 TCH-6730 FR 1 BUSY 1
2758 TCH-6729 FR 1 BUSY 1
2757 TCH-6652 FR 1 IDLE 1
2756 TCH-6651 FR 1 IDLE 1
END
注意:
WinFIOL.exe的技术文档中说: 结果是以一行一行的出的.并且

WinFIOL messages that start with "##", as in "## End of include file
'<file>'" are also sent to the client application.

并且我还发现一个怪现象:如果进行热连接的代码放在 Button1Click(Sender:TObject)
间的,在程序运行时点击Button1按钮程序出现的并不是热连接,而是Cool-link.
用WinSight32.exe得到的是WinFIOL程序不断地发出DDE数据,而我的程序却一点反应都没有.


 
注意:
WinFIOL.exe的技术文档中说: 结果是以一行一行的出的.并且
WinFIOL messages that start with "##", as in "## End of include file '<file>'"
are also sent to the client application.

并且我还发现一个怪现象:如果进行热连接的代码放在Button1Click(Sender:TObject)间的,
在程序运行时点击Button1按钮程序出现的并不是热连接,而是Cool-link.用WinSight32.exe
得到的是WinFIOL程序不断地发出DDE数据,而我的程序却一点反应都没有.
WinFIOL.exe标准输出:
<rlcrp:cell=dyg109a;
CELL RESOURCES
CELL BCCH CBCH SDCCH NOOFTCH
DYG109A 1 0 8 6
BPC CHANNEL CHRATE SPV STATE ICMBAND
2767 BCCH-34748 BUSY
2764 SDCCH-33919 IDLE 1
SDCCH-33918 IDLE 1
SDCCH-33917 IDLE 1
SDCCH-33916 IDLE 1
SDCCH-33915 IDLE 1
SDCCH-33914 IDLE 1
SDCCH-33913 IDLE 1
SDCCH-33912 IDLE 1
2761 TCH-6732 FR 1 IDLE 1
2760 TCH-6731 FR 1 BUSY 1
2759 TCH-6730 FR 1 BUSY 1
2758 TCH-6729 FR 1 BUSY 1
2757 TCH-6652 FR 1 IDLE 1
2756 TCH-6651 FR 1 IDLE 1
END




 
我认为Delphi 3.0的DDE功能比VB 5.0差得多,特别在我得程序中表现得尤其突出。热连接得到的数据,VB分毫不差,而Delphi得到的数据不是丢失,就是对同一数据重复读取。两者都是一个非常简单的实验性程序,应该不会有编程上的错误。就算Delphi如书上所说在DDE和OLE功能上比不上VB,但也不应表现如此之差。哎,真令我失望!
 
我看了Delphi的DDE功能,觉得用起来很简单,
但为什么出现你说的那种错误,我不清楚。

这种问题上比不了VB也是正常的,这种事情还多着呢!
要么微软怎了上法庭。

别泄气,如果要找出Delphi 3.0的功能比VB 5.0强得多
的地方,这里每个大虾至少都能说出十几个来。
 
多人接受答案了。
 
后退
顶部