首页 > 代码库 > VC++ LPARAMA 转换成CString

VC++ LPARAMA 转换成CString

如果是SendMessage发送的CString 

CString s = "xxxxxx";
SendMessage(hWnd,WM_XXXX,NULL,(LPARAM)&s);

消息处理函数:CString s = *((CString*)lParam);

如果使用PostMessage发送:
CString* ps = new CString("xxxxxx");
PostMessage(hWnd,WM_XXXX,NULL,(LPARAM)ps);

消息接收:
CString* ps = (CString*)lParam;
..... 消息处理
delete ps; // 清除CString, 不然会内存泄漏。

VC++ LPARAMA 转换成CString