CSerialPort问题

benny_ustc 2008-07-06 10:08:14
请问用CSerialPort怎么发送COM10以上的串口,我现在在COM9以下的都可以正常发送,但是COM10以后就不可以,请您帮忙看看,多谢
...全文
100 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
一条晚起的虫 2008-07-15
  • 打赏
  • 举报
回复
设备名称这样写
"\\\\.\\COM10"
fengye750 2008-07-15
  • 打赏
  • 举报
回复
做一下标记。
effective_person 2008-07-12
  • 打赏
  • 举报
回复
有可能是一下2种问题
1)是你没有com10以上的串口
2)是你的InitPort() 函数的问题
//
// Initialize the port. This can be port 1 to 4.
//
BOOL CSerialPort::InitPort(CWnd* pPortOwner, // the owner (CWnd) of the port (receives message)
UINT portnr, // portnumber (1..4)
UINT baud, // baudrate
char parity, // parity
UINT databits, // databits
UINT stopbits, // stopbits
DWORD dwCommEvents, // EV_RXCHAR, EV_CTS etc
UINT writebuffersize) // size to the writebuffer
{
// assert(portnr > 0 && portnr < 5);
assert(pPortOwner != NULL);

// if the thread is alive: Kill
if (m_bThreadAlive)
{
do
{
SetEvent(m_hShutdownEvent);
} while (m_bThreadAlive);
TRACE("Thread ended\n");
}
//....
}

2,640

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 硬件/系统
社区管理员
  • 硬件/系统社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧