S
Soar
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TF_Connect.Button1Click(Sender: TObject);
var
MyDDEClientConv: TDDEClientConv;
MyDDEClientItem: TDDEClientItem;
begin
MyDDEClientConv:=TDDEClientConv.Create(F_connect);
MyDDEClientItem:=TDDEClientItem.Create(F_connect);
MyDDEClientConv.ConnectMode:=ddeManual;
MyDDEClientConv.SetLink('Excel','[Book1]Sheet1');
MyDDEClientItem.DdeConv:=MyDDEClientConv;
MyDDEClientItem.DdeItem:='R1C1';
MyDDEClientItem.OnChange:=MyOnChange;
if not MyDDEClientConv.OpenLink then MessageDlg('DDe error',mtconfirmation,[mbOk],0);
end;
Procedure TF_Connect.MyOnChange(Sender: TObject);
begin
MessageDlg('我现在好使了:)我叫做DDEItem-'+TDDEClientItem(Sender).DdeItem,mtconfirmation,[mbOk],0);
end;
其中:F_Connect(TF_Connect)是我的窗体!
------------------------------------
不知道为什么连接的时候明明好使,因为看到了我设置的提示,但当我在Excel中改变R1C1
的数据时,却一点反映也没有。
但类似的代码用在Text1控件中却好使。都是动态生成的控件,怎么会这样?
var
MyDDEClientConv: TDDEClientConv;
MyDDEClientItem: TDDEClientItem;
begin
MyDDEClientConv:=TDDEClientConv.Create(F_connect);
MyDDEClientItem:=TDDEClientItem.Create(F_connect);
MyDDEClientConv.ConnectMode:=ddeManual;
MyDDEClientConv.SetLink('Excel','[Book1]Sheet1');
MyDDEClientItem.DdeConv:=MyDDEClientConv;
MyDDEClientItem.DdeItem:='R1C1';
MyDDEClientItem.OnChange:=MyOnChange;
if not MyDDEClientConv.OpenLink then MessageDlg('DDe error',mtconfirmation,[mbOk],0);
end;
Procedure TF_Connect.MyOnChange(Sender: TObject);
begin
MessageDlg('我现在好使了:)我叫做DDEItem-'+TDDEClientItem(Sender).DdeItem,mtconfirmation,[mbOk],0);
end;
其中:F_Connect(TF_Connect)是我的窗体!
------------------------------------
不知道为什么连接的时候明明好使,因为看到了我设置的提示,但当我在Excel中改变R1C1
的数据时,却一点反映也没有。
但类似的代码用在Text1控件中却好使。都是动态生成的控件,怎么会这样?