用PostMessage传参数
需要注意的事项:
由于PostMessage是异步执行的,所以参数要用new CString,然后在接收方释放
发送端:
CString* msg = new CString(desc.c_str());
PostMessage(CCounterHelper::GetInstance()->GetLoginDlgHandle(),WM_LOGIN_COUNTER_ERR,0,(LPARAM)msg);
...
接受端:
case WM_LOGIN_COUNTER_ERR:
{
CString* rmsg = (CString*)lParam;
SetStatusTxt(rmsg->GetBuffer(rmsg->GetLength()));
rmsg->ReleaseBuffer();
delete rmsg;
...
需要注意的事项:
由于PostMessage是异步执行的,所以参数要用new CString,然后在接收方释放
发送端:
CString* msg = new CString(desc.c_str());
PostMessage(CCounterHelper::GetInstance()->GetLoginDlgHandle(),WM_LOGIN_COUNTER_ERR,0,(LPARAM)msg);
...
接受端:
case WM_LOGIN_COUNTER_ERR:
{
CString* rmsg = (CString*)lParam;
SetStatusTxt(rmsg->GetBuffer(rmsg->GetLength()));
rmsg->ReleaseBuffer();
delete rmsg;
...