在VC++2005里串口编程的有关问题

在VC++2005里串口编程的问题
1.用串口控件,并关联一个变量m_mscomm,用m_mscomm.put_PortOpen(true);打开串口,
2.之后用CString abc=L"sabcdjke";
m_mscomm.put_Output(COleVariant(abc));//发送数据
3.在接收数据时用:

int iCount = 0;  
iCount =m_mscomm.get_InBufferCount();  
VARIANT vt;  
unsigned char *chData;  
chData= (unsigned char*)GlobalAlloc(GPTR,iCount+1);//该函数从堆中分配一定数目的字节数  
vt=m_mscomm.get_Input();  


memcpy(chData,(char*)(unsigned char*)vt.parray->pvData,iCount);
CString strtemp;
strtemp.Format(L"%s",chData);
MessageBox(strtemp);

为什么打印出的内容为空???


------解决方案--------------------
你Debug调试一下,你的chData有数据吗?