如何在 Delphi 上创建 RTD 客户端?我不知道如何开始,我需要像 Excel 电子表格一样获取值,例如
=RTD("gartle.rtd",,"YahooFinanceWatchList","AAPL","Open")
It says here: http://support.microsoft.com/kb/285339 that to provide an RTL server to Excel you need to implement the IRtdServer
interface, by this logic, you should be able to instantiate an existing implementation using default COM methods yourself. (YMMV)
正如 Stijn 提到的,您需要创建一个实现 IRtdServer 的 COM 自动化对象。Delphi 声明如下:
// *********************************************************************//
// 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;