C++ 中发消息,c# 中接受消息时,所带字符串出现丢失问题
我在c++ 封装的dLL 中
DWORD data_utf32[] = {0x6c49, 0x5b57}; // 汉字
SendMessage(hWnd,uiMessage,(WPARAM)(LPTSTR)data_utf32,(WPARAM)(LPTSTR)data_utf32);
然后在c# 接收到消息,处理时出现问题
string barcode = Marshal.PtrToStringUni(wParam);
Console.WriteLine("barcode = " + barcode );
这时打印应该是 barcode = 汉字
然后实际打印是 barcode = 汉 (只能得到第一个字符,很奇怪)
(我没分了)