using System;
using System.Text;
using System.Runtime.InteropServices;
namespace mytools
{
/// <summary>
/// StockDrv 的摘要说明。
/// </summary>
///
[StructLayout( LayoutKind.Sequential)]
public struct tagRCV_FILE_HEADEx
{
public int m_dwAttrib; // 文件子类型
public int m_dwLen; // 文件长度
public int m_dwSerialNoorTime; //文件序列号或时间.
[ MarshalAs( UnmanagedType.ByValArray, SizeConst=260 )]
char [] m_szFileName; // 文件名 or URL
}
[StructLayout( LayoutKind.Sequential)]
public struct tagRCV_DATA
{
public int m_wDataType; // 文件类型
public int m_nPacketNum; // 记录数,参见注一
[MarshalAs(UnmanagedType.Struct)]
public tagRCV_FILE_HEADEx m_File; // 文件接口
public int m_bDISK; // 文件是否已存盘的文件
public IntPtr m_pData;
} ;
//补历史数据
[StructLayout( LayoutKind.Sequential)]
public struct tagRCV_HISTORY_STRUCTEx
{
Int32 m_time; //UCT
Single m_fOpen; //开盘
Single m_fHigh; //最高
Single m_fLow; //最低
Single m_fClose; //收盘
Single m_fVolume; //量
Single m_fAmount; //额
UInt16 m_wAdvance; //涨数,仅大盘有效
UInt16 m_wDecline; //跌数,仅大盘有效
};
//补充分时线数据
[StructLayout(LayoutKind.Sequential)]
public struct tagRCV_MINUTE_STRUCTEx
{
public Int32 m_time; // UCT
public Single m_fPrice;
public Single m_fVolume;
public Single m_fAmount;
};
[StructLayout(LayoutKind.Sequential)]
public struct tagRCV_EKE_HEADEx
{
public UInt32 m_dwHeadTag; // = EKE_HEAD_TAG
public UInt16 m_wMarket; // 市场类型
[MarshalAs( UnmanagedType.ByValArray, SizeConst=10)]
public char []m_szLabel; // 股票代码
};
[StructLayout(LayoutKind.Sequential)]
public struct tagRCV_REPORT_STRUCTEx//: public CObject
{
public UInt16 m_cbSize; // 结构大小
public Int32 m_time; // 交易时间
public UInt16 m_wMarket; // 股票市场类型
// [MarshalAs( UnmanagedType.ByValArray, SizeConst=2)]
// byte []m_wMarket; // 股票市场类型
// [MarshalAs( UnmanagedType.ByValArray, SizeConst=10)]
// public char[] m_szLabel; // 代码,以'\0'结尾 数组大小为STKLABEL_LEN,在c++描述中为char[10]
// [MarshalAs( UnmanagedType.ByValArray, SizeConst=32)]
// public char[] m_szName; // 名称,以'\0'结尾 数组大小为STKNAME_LEN,在c++描述中为char[32]
[MarshalAs( UnmanagedType.ByValTStr, SizeConst=10)]
public string m_szLabel; // 代码,以'\0'结尾 数组大小为STKLABEL_LEN,在c++描述中为char[10]
[MarshalAs( UnmanagedType.ByValTStr, SizeConst=32)]
public string m_szName; // 名称,以'\0'结尾 数组大小为STKNAME_LEN,在c++描述中为char[32]
public Single m_fLastClose; // 昨收
public Single m_fOpen; // 今开
public Single m_fHigh; // 最高
public Single m_fLow; // 最低
public Single m_fNewPrice; // 最新
public Single m_fVolume; // 成交量
public Single m_fAmount; // 成交额
[ MarshalAs( UnmanagedType.ByValArray, SizeConst=3 )]
public Single []m_fBuyPrice; // 申买价1,2,3
[ MarshalAs( UnmanagedType.ByValArray, SizeConst=3 )]
public Single []m_fBuyVolume; // 申买量1,2,3
[ MarshalAs( UnmanagedType.ByValArray, SizeConst=3 )]
public Single []m_fSellPrice; // 申卖价1,2,3
[ MarshalAs( UnmanagedType.ByValArray, SizeConst=3 )]
public Single []m_fSellVolume; // 申卖量1,2,3
public Single m_fBuyPrice4; // 申买价4
public Single m_fBuyVolume4; // 申买量4
public Single m_fSellPrice4; // 申卖价4
public Single m_fSellVolume4; // 申卖量4
public Single m_fBuyPrice5; // 申买价5
public Single m_fBuyVolume5; // 申买量5
public Single m_fSellPrice5; // 申卖价5
public Single m_fSellVolume5; // 申卖量5
};
public class StockDrv
{
public const int FILE_HISTORY_EX = 2; // 补日线数据
public const int FILE_MINUTE_EX = 4; // 补分钟线数据
public const int FILE_POWER_EX = 6; // 补充除权数据
public const int FILE_5MINUTE_EX = 81; // 补5分钟线数据
public const int FILE_BASE_EX = 0x1000; // 钱龙兼容基本资料文件,m_szFileName仅包含文件名
public const int FILE_NEWS_EX = 0x1002; // 新闻类,其类型由m_szFileName中子目录名来定
public const int RCV_WORK_SENDMSG= 4; // 工作方式类型定义-窗口消息方式
public const int My_Msg_StkData = 0x8001; //指定使用的消息
public const int RCV_REPORT = 0x3f001234;//股票行情
public const int RCV_FILEDATA = 0x3f001235;//文件
public const int RCV_FENBIDATA =0x3f001301;//分笔数据
public const UInt32 EKE_HEAD_TAG = 0xffffffff; //数据头结构标记
[DllImport("Stock.dll")]
public static extern int Stock_Init (IntPtr nHwnd,int nMsg,int nWorkMode);
[DllImport("Stock.dll")]
public static extern int GetStockByCodeEx (string strCode,int nMarket,ref tagRCV_REPORT_STRUCTEx sRcvReort);
public StockDrv()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
}
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。