Trade.dll 股票交易接口C#调用源代码

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;

        public static CTest s_test  = new CTest();
        //回调函数占用内部线程,为防止锁死,禁用运行耗时严重任务或进行界面操作。
        public static int Answer(IntPtr ans,  IntPtr data, int len, IntPtr dataEx, int exLen)
        {
            String query = KV_BASE.String(ans, "请求");
            String pkName = KV_BASE.String(ans, "包名称");
            String err = KV_BASE.String(ans, "错误");
            String kind = KV_BASE.Kind(ans);
            int td = KV_BASE.Int(ans, "通道");
            if (err.Length > 0)
 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值