char ReceiveBuf[1024];
int iret = ReadFile(hPort, ReceiveBuf, 1024, &dwBytes, 0);
::PostMessage(recvParam->hEdit,WM_RECVDATA,0,(LPARAM)ReceiveBuf);
上面为我读取数据的代码,ReceiveBuf能正确获取数据 然后通过消息发送给窗口,但在窗口不能正确收到数据
单步调试如下
LRESULT CCOMTESTDlg::OnRecvData(WPARAM wParam,LPARAM lParam)
{
char * s = (char *)lParam;
char ss[2];
ss[0] = s[0];
ss[1] = s[1];
CString str = (WCHAR*)lParam;
return 0;
}
s cx0017 未找到符号's'
ss[0] cx0017未找到符号 ss[0]
(char *)lParam 值 为""
不知到怎么才能正确传值。 |