Delphi上的RTD客户端

时间:2014-11-06 11:32:28

标签: delphi com rtd

如何在Delphi上创建RTD客户端?我不知道如何开始,我需要获得几乎像Excel电子表格的值,如

=RTD("gartle.rtd",,"YahooFinanceWatchList","AAPL","Open")

2 个答案:

答案 0 :(得分:1)

它在这里说:http://support.microsoft.com/kb/285339为了向Excel提供RTL服务器,你需要实现IRtdServer接口,通过这个逻辑,你应该能够实例化一个现有的使用默认COM方法的实现。 (YMMV)

答案 1 :(得分:1)

正如Stijn所提到的,您需要创建一个实现IRtdServer的COM自动化对象。德尔福的声明如下:

// *********************************************************************//
// Interface: IRTDUpdateEvent
// Flags:     (4416) Dual OleAutomation Dispatchable
// GUID:      {A43788C1-D91B-11D3-8F39-00C04F3651B8}
// *********************************************************************//
IRTDUpdateEvent = interface(IDispatch)
  ['{A43788C1-D91B-11D3-8F39-00C04F3651B8}']
  procedure UpdateNotify; safecall;
  function Get_HeartbeatInterval: Integer; safecall;
  procedure Set_HeartbeatInterval(plRetVal: Integer); safecall;
  procedure Disconnect; safecall;
  property HeartbeatInterval: Integer read Get_HeartbeatInterval write Set_HeartbeatInterval;
end;

// *********************************************************************//
// Interface: IRtdServer
// Flags:     (4416) Dual OleAutomation Dispatchable
// GUID:      {EC0E6191-DB51-11D3-8F3E-00C04F3651B8}
// *********************************************************************//
IRtdServer = interface(IDispatch)
  ['{EC0E6191-DB51-11D3-8F3E-00C04F3651B8}']
  function ServerStart(const CallbackObject: IRTDUpdateEvent): Integer; safecall;
  function ConnectData(TopicID: Integer; var Strings: PSafeArray; var GetNewValues: WordBool): OleVariant; safecall;
  function RefreshData(var TopicCount: Integer): PSafeArray; safecall;
  procedure DisconnectData(TopicID: Integer); safecall;
  function Heartbeat: Integer; safecall;
  procedure ServerTerminate; safecall;
end;