⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stocklib_tlb.pas

📁 通视卡接收股票delphi7演示版,用delphi 7编写
💻 PAS
📖 第 1 页 / 共 4 页
字号:
end;

procedure TStockMinData.Connect;
var
  punk: IUnknown;
begin
  if FIntf = nil then
  begin
    punk := GetServer;
    Fintf:= punk as IStockMinData;
  end;
end;

procedure TStockMinData.ConnectTo(svrIntf: IStockMinData);
begin
  Disconnect;
  FIntf := svrIntf;
end;

procedure TStockMinData.DisConnect;
begin
  if Fintf <> nil then
  begin
    FIntf := nil;
  end;
end;

function TStockMinData.GetDefaultInterface: IStockMinData;
begin
  if FIntf = nil then
    Connect;
  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
  Result := FIntf;
end;

constructor TStockMinData.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps := TStockMinDataProperties.Create(Self);
{$ENDIF}
end;

destructor TStockMinData.Destroy;
begin
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps.Free;
{$ENDIF}
  inherited Destroy;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
function TStockMinData.GetServerProperties: TStockMinDataProperties;
begin
  Result := FProps;
end;
{$ENDIF}

function TStockMinData.Get_ArrayIndexer: Smallint;
begin
    Result := DefaultInterface.ArrayIndexer;
end;

function TStockMinData.Get_strLabel: WideString;
begin
    Result := DefaultInterface.strLabel;
end;

function TStockMinData.Get_Market: OLE_MARKET_ENUM;
begin
    Result := DefaultInterface.Market;
end;

function TStockMinData.Get_Time: TDateTime;
begin
    Result := DefaultInterface.Time;
end;

function TStockMinData.Get_Price: Single;
begin
    Result := DefaultInterface.Price;
end;

function TStockMinData.Get_Volume: Single;
begin
    Result := DefaultInterface.Volume;
end;

function TStockMinData.Get_Amount: Single;
begin
    Result := DefaultInterface.Amount;
end;

function TStockMinData.Get_PacketNum: Smallint;
begin
    Result := DefaultInterface.PacketNum;
end;

function TStockMinData.Get_ElementAt(i: Integer): OLE_RCV_MINUTE;
begin
    Result := DefaultInterface.ElementAt[i];
end;

procedure TStockMinData.Attach(nPacketNum: Smallint; pDataBuf: Integer);
begin
  DefaultInterface.Attach(nPacketNum, pDataBuf);
end;

procedure TStockMinData.Next;
begin
  DefaultInterface.Next;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
constructor TStockMinDataProperties.Create(AServer: TStockMinData);
begin
  inherited Create;
  FServer := AServer;
end;

function TStockMinDataProperties.GetDefaultInterface: IStockMinData;
begin
  Result := FServer.DefaultInterface;
end;

function TStockMinDataProperties.Get_ArrayIndexer: Smallint;
begin
    Result := DefaultInterface.ArrayIndexer;
end;

function TStockMinDataProperties.Get_strLabel: WideString;
begin
    Result := DefaultInterface.strLabel;
end;

function TStockMinDataProperties.Get_Market: OLE_MARKET_ENUM;
begin
    Result := DefaultInterface.Market;
end;

function TStockMinDataProperties.Get_Time: TDateTime;
begin
    Result := DefaultInterface.Time;
end;

function TStockMinDataProperties.Get_Price: Single;
begin
    Result := DefaultInterface.Price;
end;

function TStockMinDataProperties.Get_Volume: Single;
begin
    Result := DefaultInterface.Volume;
end;

function TStockMinDataProperties.Get_Amount: Single;
begin
    Result := DefaultInterface.Amount;
end;

function TStockMinDataProperties.Get_PacketNum: Smallint;
begin
    Result := DefaultInterface.PacketNum;
end;

function TStockMinDataProperties.Get_ElementAt(i: Integer): OLE_RCV_MINUTE;
begin
    Result := DefaultInterface.ElementAt[i];
end;

{$ENDIF}

class function CoStockHisData.Create: IStockHisData;
begin
  Result := CreateComObject(CLASS_StockHisData) as IStockHisData;
end;

class function CoStockHisData.CreateRemote(const MachineName: string): IStockHisData;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_StockHisData) as IStockHisData;
end;

procedure TStockHisData.InitServerData;
const
  CServerData: TServerData = (
    ClassID:   '{E518BACB-E53B-11D2-B30C-00C04FCCA334}';
    IntfIID:   '{A22E1441-E61B-11D2-B30C-00C04FCCA334}';
    EventIID:  '';
    LicenseKey: nil;
    Version: 500);
begin
  ServerData := @CServerData;
end;

procedure TStockHisData.Connect;
var
  punk: IUnknown;
begin
  if FIntf = nil then
  begin
    punk := GetServer;
    Fintf:= punk as IStockHisData;
  end;
end;

procedure TStockHisData.ConnectTo(svrIntf: IStockHisData);
begin
  Disconnect;
  FIntf := svrIntf;
end;

procedure TStockHisData.DisConnect;
begin
  if Fintf <> nil then
  begin
    FIntf := nil;
  end;
end;

function TStockHisData.GetDefaultInterface: IStockHisData;
begin
  if FIntf = nil then
    Connect;
  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
  Result := FIntf;
end;

constructor TStockHisData.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps := TStockHisDataProperties.Create(Self);
{$ENDIF}
end;

destructor TStockHisData.Destroy;
begin
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps.Free;
{$ENDIF}
  inherited Destroy;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
function TStockHisData.GetServerProperties: TStockHisDataProperties;
begin
  Result := FProps;
end;
{$ENDIF}

function TStockHisData.Get_ArrayIndexer: Integer;
begin
    Result := DefaultInterface.ArrayIndexer;
end;

function TStockHisData.Get_strLabel: WideString;
begin
    Result := DefaultInterface.strLabel;
end;

function TStockHisData.Get_Market: OLE_MARKET_ENUM;
begin
    Result := DefaultInterface.Market;
end;

function TStockHisData.Get_OpenPrice: Single;
begin
    Result := DefaultInterface.OpenPrice;
end;

function TStockHisData.Get_Time: TDateTime;
begin
    Result := DefaultInterface.Time;
end;

function TStockHisData.Get_HighPrice: Single;
begin
    Result := DefaultInterface.HighPrice;
end;

function TStockHisData.Get_LowPrice: Single;
begin
    Result := DefaultInterface.LowPrice;
end;

function TStockHisData.Get_ClosePrice: Single;
begin
    Result := DefaultInterface.ClosePrice;
end;

function TStockHisData.Get_Volume: Single;
begin
    Result := DefaultInterface.Volume;
end;

function TStockHisData.Get_Amount: Single;
begin
    Result := DefaultInterface.Amount;
end;

function TStockHisData.Get_AdvanceNum: Integer;
begin
    Result := DefaultInterface.AdvanceNum;
end;

function TStockHisData.Get_DeclineNum: Integer;
begin
    Result := DefaultInterface.DeclineNum;
end;

function TStockHisData.Get_PacketNum: Integer;
begin
    Result := DefaultInterface.PacketNum;
end;

function TStockHisData.Get_ElementAt(i: Integer): OLE_RCV_HISTORY;
begin
    Result := DefaultInterface.ElementAt[i];
end;

procedure TStockHisData.Attach(nPacket: Integer; pBuf: Integer);
begin
  DefaultInterface.Attach(nPacket, pBuf);
end;

procedure TStockHisData.Next;
begin
  DefaultInterface.Next;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
constructor TStockHisDataProperties.Create(AServer: TStockHisData);
begin
  inherited Create;
  FServer := AServer;
end;

function TStockHisDataProperties.GetDefaultInterface: IStockHisData;
begin
  Result := FServer.DefaultInterface;
end;

function TStockHisDataProperties.Get_ArrayIndexer: Integer;
begin
    Result := DefaultInterface.ArrayIndexer;
end;

function TStockHisDataProperties.Get_strLabel: WideString;
begin
    Result := DefaultInterface.strLabel;
end;

function TStockHisDataProperties.Get_Market: OLE_MARKET_ENUM;
begin
    Result := DefaultInterface.Market;
end;

function TStockHisDataProperties.Get_OpenPrice: Single;
begin
    Result := DefaultInterface.OpenPrice;
end;

function TStockHisDataProperties.Get_Time: TDateTime;
begin
    Result := DefaultInterface.Time;
end;

function TStockHisDataProperties.Get_HighPrice: Single;
begin
    Result := DefaultInterface.HighPrice;
end;

function TStockHisDataProperties.Get_LowPrice: Single;
begin
    Result := DefaultInterface.LowPrice;
end;

function TStockHisDataProperties.Get_ClosePrice: Single;
begin
    Result := DefaultInterface.ClosePrice;
end;

function TStockHisDataProperties.Get_Volume: Single;
begin
    Result := DefaultInterface.Volume;
end;

function TStockHisDataProperties.Get_Amount: Single;
begin
    Result := DefaultInterface.Amount;
end;

function TStockHisDataProperties.Get_AdvanceNum: Integer;
begin
    Result := DefaultInterface.AdvanceNum;
end;

function TStockHisDataProperties.Get_DeclineNum: Integer;
begin
    Result := DefaultInterface.DeclineNum;
end;

function TStockHisDataProperties.Get_PacketNum: Integer;
begin
    Result := DefaultInterface.PacketNum;
end;

function TStockHisDataProperties.Get_ElementAt(i: Integer): OLE_RCV_HISTORY;
begin
    Result := DefaultInterface.ElementAt[i];
end;

{$ENDIF}

procedure Register;
begin
  RegisterComponents(dtlOcxPage, [TStockDriver]);
  RegisterComponents(dtlServerPage, [TStockReport, TStockMinData, TStockHisData]);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -