typedef bool(__stdcall * TDevicelist_Callback)(Device_set * aset) ;
typedef  struct tagDevice_set
{
  Int  id;
  Char  _name[32];
  Char   username[32];
  Char   userpass[16];
  Char   ip [16];
  Uint   port;
  Byte   channel_count;
  Byte   start_channel;
  Byte   device_type;
}Device_set;
上述的回调函数如何转换成C#语言的

解决方案 »

  1.   

    把指针用C#中的IntPtr代替,重写
      

  2.   

    把指针用C#中的IntPtr代替,重写这个回调函数是要把获得的设备添加到一个列表,后面的参数又是一个结构指针,不会弄了,请帮忙
      

  3.   

    一样的阿 ,遇到指针就用IntPtr,如果是要传结构体指针,就先重写结构体,然后用IntPtr指向结构体,就可以传递了
      

  4.   

    http://wenku.baidu.com/view/5126f84b2b160b4e767fcf85.html?st=1这个是重写C++内容的
      

  5.   

    Char Uint Byte 这些是怎么定义的?
      

  6.   

    int __stdcall PQNVR_GetDeviceList(uint userid, TDeviceList_CallBack callback)这个事函数原型
      

  7.   

    public static extern int PXNVR_GetDeviceList(uint userid,IntPtr callback);
      

  8.   

    有高手在的,帮我也解决一下问题哦,拜托阿http://topic.csdn.net/u/20120702/13/84f6a6d6-6830-4878-badd-2d4cf8c2f94c.html?seed=298568158&r=79006639#r_79006639
      

  9.   

    应该和C++差不多,参考下这个链接。
    http://wenku.baidu.com/view/9f2ef117a216147917112813.html?st=1
      

  10.   


            //类型定义
            [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
            internal struct Device_set
            {
                public int id;
                [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
                public string _name;
                [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
                public string username;
                [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
                public string userpass;
                [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
                public string ip;
                public uint port;
                public byte channel_count;
                public byte start_channel;
                public byte device_type;
            }        internal delegate bool TDevicelist_Callback(ref Device_set ds);
            //DLL导入
            [DllImport("DLL名字", CallingConvention = CallingConvention.StdCall)]
            internal static extern int PQNVR_GetDeviceList(uint userid, TDevicelist_Callback callback);试试