首页 > 编程语言 > 详细

调用c++接口类

时间:2014-03-05 18:33:02      阅读:511      评论:0      收藏:0      [点我收藏+]

调用c++接口类

bubuko.com,布布扣
 public class CarDeviceDll
    {
        /*对dll库进行一些初始化*/
        [DllImport("IDI.dll")]
        public static extern int Init_IDI(string IP, int port);

        [DllImport("IDI.dll")]
        public static extern int Connect_IDI(string IP, int port);

        /*由客户端定时向服务器发送命令,检测连接状态*/
        [DllImport("IDI.dll")]
        public static extern void HeartBeat_IDI();

        /*从服务端接受数据*/
        [DllImport("IDI.dll")]
        public static extern int Recv_IDI(ref Client_Data rec);

        [DllImport("IDI.dll")]
        public static extern int QuideInfo_Check(byte DoorNo);


        [DllImport("IDI.dll")]
        public static extern int GetPic_From_Server_IDI(byte[] name, byte[] pic, int len);

        [DllImport("IDI.dll")]
        public static extern int GetPerson_From_Server_IDI(byte[] name, byte[] pic, int len);

        [DllImport("IDI.dll")]
        public static extern int Send_IDI(string sed,int iLen);
        [StructLayout(LayoutKind.Sequential, Pack = 1)]
        public struct Client_Data_Head 
        {
            public UInt16 wHeader;
            public int iReserved;
            public byte byCommand;
            public  UInt16 wDataLen;
        }


        [StructLayout(LayoutKind.Sequential, Pack = 1)]
        public struct Client_Data
        {
            public UInt16 wHeader;
            public int iReserved;
            public byte byCommand;
            public UInt16 wDataLen;
            
            [MarshalAs(UnmanagedType.ByValTStr,SizeConst=160)]
            public string szData;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 1)]
        public struct PClientData
        {
            public UInt16 wHeader;
            public int iReserved;
            public byte byCommand;
            public UInt16 wDataLen;
            
            [MarshalAs(UnmanagedType.ByValTStr,SizeConst=160)]
            public string szData;
        }

    }
bubuko.com,布布扣

调用c++接口类,布布扣,bubuko.com

调用c++接口类

原文:http://www.cnblogs.com/markli/p/3581946.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!