首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C# 转 c++ typedef struct解决方法

2013-11-03 
C# 转 c++ typedef structtypedef struct{int Countstruct{int Pressint Code}Keys[6]}VK_SENDKEY,*PV

C# 转 c++ typedef struct

typedef struct
{
int Count;
struct
{
int Press;
int Code;
}Keys[6];
}VK_SENDKEY,*PVK_SENDKEY;


请问各位大神,这种c++格式转换成c#怎么表达啊,要调用c++编译的dll啊。 typedef?struct
[解决办法]
[StructLayout(LayoutKind.Sequential)]
public struct Key
{
    public int Press;
    public int Code;
}
[StructLayout(LayoutKind.Sequential)]
public struct VK_SENDKEY
{
    public int Count;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
    public Key[] Keys;
}

[解决办法]
KeyData.Keys = new Key[6];
  
*****************************************************************************
签名档: http://feiyun0112.cnblogs.com/
[解决办法]
struct _Key_
{
  int Press;
  int Code;
};

struct VK_SENDKEY
{
    int Count;
    _Key_ Keys[]=new _Key_[6];
};

热点排行