Trade.dll 股票交易接口C#调用源代码
http://www.nezip.cn/forum.php?mod=viewthread&tid=9&fromuid=1
(出处: 网际风官网)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using System.Collections.Specialized;
using System.Web;
using System.Net.Sockets;
using static System.Net.Mime.MediaTypeNames;
//总体说明:调用很简单,载入dll→发出指令→等待结果→解析结果
namespace TradeCS
{
class CTest
{
[DllImport("Trade.dll")]
private extern static int Start(RcvCallback_ callBack, IntPtr answer, int maxLen); //注册回调函数
[DllImport("Trade.dll")]
public extern static int Ask([MarshalAs(UnmanagedType.LPTStr)] string ask, IntPtr answer, int maxLen); //发出指令,参数参考调用规范填写,比如 下单?请求=登录&券商=信达证券
[DllImport("Trade.dll")]
private extern static int Stop(); //注销
[UnmanagedFunctionPointerAttribute(CallingConvention.StdCall, CharSet = CharSet.Unicode)]
public delegate int RcvCallback_(IntPtr ans, IntPtr data, int len, IntPtr dataEx, int exLen); //定义回调函数对应的委托
public static RcvCallback_ m_callBack = null;
public static TcpC m_tdx = null;