例如,TBBUTTON的定义为typedef struct {
int iBitmap;
int idCommand;
BYTE fsState;
BYTE fsStyle;
#ifdef _WIN64
BYTE bReserved[6];
#else
#if defined(_WIN32)
BYTE bReserved[2];
#endif
#endif
DWORD_PTR dwData;
INT_PTR iString;
} TBBUTTON, *PTBBUTTON, *LPTBBUTTON;中间这一段,如果是64位下应该写成[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[] bReserved;如果是32位下应该是[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2)]
public byte[] bReserved;那么这个结构体应该怎么定义呢?
int iBitmap;
int idCommand;
BYTE fsState;
BYTE fsStyle;
#ifdef _WIN64
BYTE bReserved[6];
#else
#if defined(_WIN32)
BYTE bReserved[2];
#endif
#endif
DWORD_PTR dwData;
INT_PTR iString;
} TBBUTTON, *PTBBUTTON, *LPTBBUTTON;中间这一段,如果是64位下应该写成[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[] bReserved;如果是32位下应该是[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2)]
public byte[] bReserved;那么这个结构体应该怎么定义呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货