VC中CString和WPARAM之间的相互转换

在传递自己定义消息的过程中。须要转换CString 变量。

 

在发送消息端使用例如以下方法:

 

SendMessage(WM_MESSAG_MINE,0,(LPARAM)strVal.AllocSysString());

----------------------------------------

在接收消息端使用:

BSTR b = (BSTR)lParam;
CString s(b);
SysFreeString(b);
AfxMessageBox(s);

原文地址:https://www.cnblogs.com/jhcelue/p/6900092.html