谁有TurboPower、spcomm、mscomm的控件啊?
因为准备学串口通信,对这方面也不熟,所以希望各位能发些说明文档给我。

解决方案 »

  1.   

    在项目中插入MSComm控件
    添加串口事件消息处理函数OnComm()
    void CSCommTestDlg::OnComm() 
    {
        // TODO: Add your control notification handler code here
     }打开串口和设置串口参数
    CSCommTestDlg::OnInitDialog()
    // TODO: Add extra initialization here
    if(m_ctrlComm.GetPortOpen())
    m_ctrlComm.SetPortOpen(FALSE);m_ctrlComm.SetCommPort(1); //选择com1
    if( !m_ctrlComm.GetPortOpen())
    m_ctrlComm.SetPortOpen(TRUE);//打开串口
    else
    AfxMessageBox("cannot open serial port");m_ctrlComm.SetSettings("9600,n,8,1"); 
    m_ctrlComm.SetInputMode(1); 
    m_ctrlComm.SetRThreshold(1); 
    m_ctrlComm.SetInputLen(0); 
    m_ctrlComm.GetInput();