关于多线程读写串口的有关问题

关于多线程读写串口的问题
谁能提供一个用API函数实现的例子,谢谢!

------解决方案--------------------
是一段关于多线程串口通信的:

UINT CommProc(LPVOID pParam)
{
OVERLAPPED os;
DWORD dwMask, dwTrans;
COMSTAT ComStat;
DWORD dwErrorFlags;

CEasyMapDoc *pDoc=(CEasyMapDoc*)pParam;

memset(&os, 0, sizeof(OVERLAPPED));
os.hEvent=CreateEvent(NULL, TRUE, FALSE, NULL);

if(os.hEvent==NULL)
{
AfxMessageBox( "无法创建事件对象! ");
return (UINT)-1;
}

while(pDoc-> m_bConnected)
{
ClearCommError(pDoc-> m_hCom,&dwErrorFlags,&ComStat);

if(ComStat.cbInQue> 10)
{

CString strtemp= " ";
char ch[64];
int nLength=0;

do{
pDoc-> ReadComm(ch,1);
}while(ch[0]!= '$ ');

pDoc-> ReadComm(ch,52);
for(int i=0;i <52;i++)
{
strtemp+=ch[i];
}

CMainFrame* pFrm=(CMainFrame*)AfxGetMainWnd();
CEasyMapView* pView=(CEasyMapView*)pFrm-> GetActiveView();

pView-> ReadDataAndAddPoints(strtemp);
------解决方案--------------------
看鄙人的Blog
http://blog.csdn.net/Waiting4you/archive/2007/04/14/1564567.aspx