C#与C++之间类型的对应

来源:互联网 发布:knn算法原理 编辑:程序博客网 时间:2024/05/16 06:40

Windows Data Type.NET Data TypeBOOL, BOOLEANBoolean or Int32BSTRStringBYTEByteCHARCharDOUBLEDoubleDWORDInt32 or UInt32FLOATSingleHANDLE (and all other handle types, such as HFONT and HMENU)IntPtr, UintPtr or HandleRef HRESULTInt32 or UInt32INTInt32LANGIDInt16 or UInt16LCIDInt32 or UInt32LONGInt32LPARAMIntPtr, UintPtr or ObjectLPCSTRStringLPCTSTRStringLPCWSTRStringLPSTRString or StringBuilder*LPTSTRString or StringBuilderLPWSTRString or StringBuilderLPVOIDIntPtr, UintPtr or ObjectLRESULTIntPtrSAFEARRAY.NET array typeSHORTInt16TCHARCharUCHARSByteUINTInt32 or UInt32ULONGInt32 or UInt32VARIANTObjectVARIANT_BOOLBooleanWCHARCharWORDInt16 or UInt16WPARAMIntPtr, UintPtr or Object

另: 在进行string转换时,需要加入前缀[MarshalAs(UnmanagedType.LPStr)]

lpdword 对应于 ref int

原创粉丝点击