标签:dll port class .dll imp 托管 string att char
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类型参数的乱码处理
标签:dll port class .dll imp 托管 string att char
原文地址:http://www.cnblogs.com/nicobilipoi/p/6775443.html