首页 > 编程语言 > 详细

C# 调用 c++ 非托管dll时wchar类型参数的乱码处理

时间:2017-04-27 18:42:35      阅读:477      评论:0      收藏:0      [点我收藏+]
1         [DllImport("user32.dll", CallingConvention = CallingConvention.WinApi)]
2         public static extern IntPtr FindWindow(
3             [MarshalAsAttribute(UnmanagedType.LPWStr)] string lpWindowClass,
4             [MarshalAsAttribute(UnmanagedType.LPWStr)] string lpWindowName
5         );

在相应的参数前加上 [MarshalAsAttribute(UnmanagedType.LPWStr)] ,这样就不会导致乱码了

C# 调用 c++ 非托管dll时wchar类型参数的乱码处理

原文:http://www.cnblogs.com/nicobilipoi/p/6775443.html

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