📄 stocklib_tlb.pas
字号:
procedure Attach(nPacket: Integer; pBuf: Integer);
procedure Next;
property DefaultInterface: IStockHisData read GetDefaultInterface;
property ArrayIndexer: Integer read Get_ArrayIndexer;
property strLabel: WideString read Get_strLabel;
property Market: OLE_MARKET_ENUM read Get_Market;
property OpenPrice: Single read Get_OpenPrice;
property Time: TDateTime read Get_Time;
property HighPrice: Single read Get_HighPrice;
property LowPrice: Single read Get_LowPrice;
property ClosePrice: Single read Get_ClosePrice;
property Volume: Single read Get_Volume;
property Amount: Single read Get_Amount;
property AdvanceNum: Integer read Get_AdvanceNum;
property DeclineNum: Integer read Get_DeclineNum;
property PacketNum: Integer read Get_PacketNum;
property ElementAt[i: Integer]: OLE_RCV_HISTORY read Get_ElementAt;
published
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
property Server: TStockHisDataProperties read GetServerProperties;
{$ENDIF}
end;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
// *********************************************************************//
// OLE Server Properties Proxy Class
// Server Object : TStockHisData
// (This object is used by the IDE's Property Inspector to allow editing
// of the properties of this server)
// *********************************************************************//
TStockHisDataProperties = class(TPersistent)
private
FServer: TStockHisData;
function GetDefaultInterface: IStockHisData;
constructor Create(AServer: TStockHisData);
protected
function Get_ArrayIndexer: Integer;
function Get_strLabel: WideString;
function Get_Market: OLE_MARKET_ENUM;
function Get_OpenPrice: Single;
function Get_Time: TDateTime;
function Get_HighPrice: Single;
function Get_LowPrice: Single;
function Get_ClosePrice: Single;
function Get_Volume: Single;
function Get_Amount: Single;
function Get_AdvanceNum: Integer;
function Get_DeclineNum: Integer;
function Get_PacketNum: Integer;
function Get_ElementAt(i: Integer): OLE_RCV_HISTORY;
public
property DefaultInterface: IStockHisData read GetDefaultInterface;
published
end;
{$ENDIF}
procedure Register;
resourcestring
dtlServerPage = 'Md1';
dtlOcxPage = 'Md1';
implementation
uses ComObj;
procedure TStockDriver.InitControlData;
const
CEventDispIDs: array [0..4] of DWORD = (
$00000001, $00000002, $00000003, $00000004, $00000005);
CControlData: TControlData2 = (
ClassID: '{9FD507CA-E42F-11D2-B30C-00C04FCCA334}';
EventIID: '{9FD507CB-E42F-11D2-B30C-00C04FCCA334}';
EventCount: 5;
EventDispIDs: @CEventDispIDs;
LicenseKey: nil (*HR:$80004002*);
Flags: $00000001;
Version: 401);
begin
ControlData := @CControlData;
TControlData2(CControlData).FirstEventOfs := Cardinal(@@FOnReport) - Cardinal(Self);
end;
procedure TStockDriver.CreateControl;
procedure DoCreate;
begin
FIntf := IUnknown(OleObject) as IStockDriver;
end;
begin
if FIntf = nil then DoCreate;
end;
function TStockDriver.GetControlInterface: IStockDriver;
begin
CreateControl;
Result := FIntf;
end;
procedure TStockDriver.Receive;
begin
DefaultInterface.Receive;
end;
procedure TStockDriver.Stop;
begin
DefaultInterface.Stop;
end;
procedure TStockDriver.Setup(bShowWnd: Integer);
begin
DefaultInterface.Setup(bShowWnd);
end;
function TStockDriver.ToString(nBufLen: SYSINT; pBuf: Integer): WideString;
begin
Result := DefaultInterface.ToString(nBufLen, pBuf);
end;
function TStockDriver.ReceiveEx: Integer;
begin
Result := DefaultInterface.ReceiveEx;
end;
class function CoStockReport.Create: IStockReport;
begin
Result := CreateComObject(CLASS_StockReport) as IStockReport;
end;
class function CoStockReport.CreateRemote(const MachineName: string): IStockReport;
begin
Result := CreateRemoteComObject(MachineName, CLASS_StockReport) as IStockReport;
end;
procedure TStockReport.InitServerData;
const
CServerData: TServerData = (
ClassID: '{E518BAC7-E53B-11D2-B30C-00C04FCCA334}';
IntfIID: '{E518BAC6-E53B-11D2-B30C-00C04FCCA334}';
EventIID: '';
LicenseKey: nil;
Version: 500);
begin
ServerData := @CServerData;
end;
procedure TStockReport.Connect;
var
punk: IUnknown;
begin
if FIntf = nil then
begin
punk := GetServer;
Fintf:= punk as IStockReport;
end;
end;
procedure TStockReport.ConnectTo(svrIntf: IStockReport);
begin
Disconnect;
FIntf := svrIntf;
end;
procedure TStockReport.DisConnect;
begin
if Fintf <> nil then
begin
FIntf := nil;
end;
end;
function TStockReport.GetDefaultInterface: IStockReport;
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 TStockReport.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
FProps := TStockReportProperties.Create(Self);
{$ENDIF}
end;
destructor TStockReport.Destroy;
begin
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
FProps.Free;
{$ENDIF}
inherited Destroy;
end;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
function TStockReport.GetServerProperties: TStockReportProperties;
begin
Result := FProps;
end;
{$ENDIF}
function TStockReport.Get_ArrayIndexer: Smallint;
begin
Result := DefaultInterface.ArrayIndexer;
end;
procedure TStockReport.Set_ArrayIndexer(pVal: Smallint);
begin
DefaultInterface.Set_ArrayIndexer(pVal);
end;
function TStockReport.Get_strLabel: WideString;
begin
Result := DefaultInterface.strLabel;
end;
function TStockReport.Get_Time: TDateTime;
begin
Result := DefaultInterface.Time;
end;
function TStockReport.Get_strName: WideString;
begin
Result := DefaultInterface.strName;
end;
function TStockReport.Get_Market: OLE_MARKET_ENUM;
begin
Result := DefaultInterface.Market;
end;
function TStockReport.Get_LastClose: Single;
begin
Result := DefaultInterface.LastClose;
end;
function TStockReport.Get_OpenPrice: Single;
begin
Result := DefaultInterface.OpenPrice;
end;
function TStockReport.Get_HighPrice: Single;
begin
Result := DefaultInterface.HighPrice;
end;
function TStockReport.Get_LowPrice: Single;
begin
Result := DefaultInterface.LowPrice;
end;
function TStockReport.Get_NewPrice: Single;
begin
Result := DefaultInterface.NewPrice;
end;
function TStockReport.Get_Volume: Single;
begin
Result := DefaultInterface.Volume;
end;
function TStockReport.Get_Amount: Single;
begin
Result := DefaultInterface.Amount;
end;
function TStockReport.Get_BuyPrice(i: Smallint): Single;
begin
Result := DefaultInterface.BuyPrice[i];
end;
function TStockReport.Get_BuyVolume(i: Smallint): Single;
begin
Result := DefaultInterface.BuyVolume[i];
end;
function TStockReport.Get_SellPrice(i: Smallint): Single;
begin
Result := DefaultInterface.SellPrice[i];
end;
function TStockReport.Get_SellVolume(i: Smallint): Single;
begin
Result := DefaultInterface.SellVolume[i];
end;
function TStockReport.Get_ElementAt(nNo: SYSINT): OLE_RCV_REPORT;
begin
Result := DefaultInterface.ElementAt[nNo];
end;
procedure TStockReport.Attach(nPacketNum: Integer; pDataBuf: Integer);
begin
DefaultInterface.Attach(nPacketNum, pDataBuf);
end;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
constructor TStockReportProperties.Create(AServer: TStockReport);
begin
inherited Create;
FServer := AServer;
end;
function TStockReportProperties.GetDefaultInterface: IStockReport;
begin
Result := FServer.DefaultInterface;
end;
function TStockReportProperties.Get_ArrayIndexer: Smallint;
begin
Result := DefaultInterface.ArrayIndexer;
end;
procedure TStockReportProperties.Set_ArrayIndexer(pVal: Smallint);
begin
DefaultInterface.Set_ArrayIndexer(pVal);
end;
function TStockReportProperties.Get_strLabel: WideString;
begin
Result := DefaultInterface.strLabel;
end;
function TStockReportProperties.Get_Time: TDateTime;
begin
Result := DefaultInterface.Time;
end;
function TStockReportProperties.Get_strName: WideString;
begin
Result := DefaultInterface.strName;
end;
function TStockReportProperties.Get_Market: OLE_MARKET_ENUM;
begin
Result := DefaultInterface.Market;
end;
function TStockReportProperties.Get_LastClose: Single;
begin
Result := DefaultInterface.LastClose;
end;
function TStockReportProperties.Get_OpenPrice: Single;
begin
Result := DefaultInterface.OpenPrice;
end;
function TStockReportProperties.Get_HighPrice: Single;
begin
Result := DefaultInterface.HighPrice;
end;
function TStockReportProperties.Get_LowPrice: Single;
begin
Result := DefaultInterface.LowPrice;
end;
function TStockReportProperties.Get_NewPrice: Single;
begin
Result := DefaultInterface.NewPrice;
end;
function TStockReportProperties.Get_Volume: Single;
begin
Result := DefaultInterface.Volume;
end;
function TStockReportProperties.Get_Amount: Single;
begin
Result := DefaultInterface.Amount;
end;
function TStockReportProperties.Get_BuyPrice(i: Smallint): Single;
begin
Result := DefaultInterface.BuyPrice[i];
end;
function TStockReportProperties.Get_BuyVolume(i: Smallint): Single;
begin
Result := DefaultInterface.BuyVolume[i];
end;
function TStockReportProperties.Get_SellPrice(i: Smallint): Single;
begin
Result := DefaultInterface.SellPrice[i];
end;
function TStockReportProperties.Get_SellVolume(i: Smallint): Single;
begin
Result := DefaultInterface.SellVolume[i];
end;
function TStockReportProperties.Get_ElementAt(nNo: SYSINT): OLE_RCV_REPORT;
begin
Result := DefaultInterface.ElementAt[nNo];
end;
{$ENDIF}
class function CoStockMinData.Create: IStockMinData;
begin
Result := CreateComObject(CLASS_StockMinData) as IStockMinData;
end;
class function CoStockMinData.CreateRemote(const MachineName: string): IStockMinData;
begin
Result := CreateRemoteComObject(MachineName, CLASS_StockMinData) as IStockMinData;
end;
procedure TStockMinData.InitServerData;
const
CServerData: TServerData = (
ClassID: '{E518BAC9-E53B-11D2-B30C-00C04FCCA334}';
IntfIID: '{78B9E8B1-E5FA-11D2-B30C-00C04FCCA334}';
EventIID: '';
LicenseKey: nil;
Version: 500);
begin
ServerData := @CServerData;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -