程序写出来了,目的是向串口传数据,但是我写的程序运行之后不管按哪个按钮发的数据是一样的,不知道是哪儿的问题,希望高手能帮忙看一下,感激不尽
void CCarSmartDlg::OnButton()
{
// TODO: Add your control notification handler code here
if(m_radio1 == 1) //1号车停
{
m_strTXData = "0001";
}
else if(m_radio2 == 2) //1号车慢
{
m_strTXData = "0002";
}
else if(m_radio3 == 3) //1号车快
{
m_strTXData = "0003";
}
else if(m_radio4 == 4) //1号车停
{
m_strTXData = "0101";
}
else if(m_radio5 == 5) //1号车停
{
m_strTXData = "0102";
}
else if(m_radio6 == 6) //1号车停
{
m_strTXData = "0103";
}
else if(m_radio7 == 7) //1号车停
{
m_strTXData = "0201";
}
else if(m_radio8 == 8) //1号车停
{
m_strTXData = "0202";
}
else if(m_radio9 == 9) //1号车停
{
m_strTXData = "0203";
}
m_ctrlComm.SetOutput(COleVariant(m_strTXData));//发送数据
}
void CCarSmartDlg::OnRadio1()
{
// TODO: Add your control notification handler code here
m_radio1 = 1;
}void CCarSmartDlg::OnRadio2()
{
// TODO: Add your control notification handler code here
m_radio2 = 2;
}void CCarSmartDlg::OnRadio3()
{
// TODO: Add your control notification handler code here
m_radio3 = 3;
}void CCarSmartDlg::OnRadio4()
{
// TODO: Add your control notification handler code here
m_radio4 = 4;
}void CCarSmartDlg::OnRadio5()
{
// TODO: Add your control notification handler code here
m_radio5 = 5;
}void CCarSmartDlg::OnRadio6()
{
// TODO: Add your control notification handler code here
m_radio6 = 6;
}void CCarSmartDlg::OnRadio7()
{
// TODO: Add your control notification handler code here
m_radio7 = 7;
}void CCarSmartDlg::OnRadio8()
{
// TODO: Add your control notification handler code here
m_radio8 = 8;
}void CCarSmartDlg::OnRadio9()
{
// TODO: Add your control notification handler code here
m_radio9 = 9;
}
void CCarSmartDlg::OnButton()
{
// TODO: Add your control notification handler code here
if(m_radio1 == 1) //1号车停
{
m_strTXData = "0001";
}
else if(m_radio2 == 2) //1号车慢
{
m_strTXData = "0002";
}
else if(m_radio3 == 3) //1号车快
{
m_strTXData = "0003";
}
else if(m_radio4 == 4) //1号车停
{
m_strTXData = "0101";
}
else if(m_radio5 == 5) //1号车停
{
m_strTXData = "0102";
}
else if(m_radio6 == 6) //1号车停
{
m_strTXData = "0103";
}
else if(m_radio7 == 7) //1号车停
{
m_strTXData = "0201";
}
else if(m_radio8 == 8) //1号车停
{
m_strTXData = "0202";
}
else if(m_radio9 == 9) //1号车停
{
m_strTXData = "0203";
}
m_ctrlComm.SetOutput(COleVariant(m_strTXData));//发送数据
}
void CCarSmartDlg::OnRadio1()
{
// TODO: Add your control notification handler code here
m_radio1 = 1;
}void CCarSmartDlg::OnRadio2()
{
// TODO: Add your control notification handler code here
m_radio2 = 2;
}void CCarSmartDlg::OnRadio3()
{
// TODO: Add your control notification handler code here
m_radio3 = 3;
}void CCarSmartDlg::OnRadio4()
{
// TODO: Add your control notification handler code here
m_radio4 = 4;
}void CCarSmartDlg::OnRadio5()
{
// TODO: Add your control notification handler code here
m_radio5 = 5;
}void CCarSmartDlg::OnRadio6()
{
// TODO: Add your control notification handler code here
m_radio6 = 6;
}void CCarSmartDlg::OnRadio7()
{
// TODO: Add your control notification handler code here
m_radio7 = 7;
}void CCarSmartDlg::OnRadio8()
{
// TODO: Add your control notification handler code here
m_radio8 = 8;
}void CCarSmartDlg::OnRadio9()
{
// TODO: Add your control notification handler code here
m_radio9 = 9;
}
解决方案 »
- 如何实现树形结构拖动节点成为目的节点的兄弟节点,而不是子节点
- GDI+中的DrawARC函数怎么用
- 为什么CRichEditCtrl中的字体不一致
- 如何知道程序在release状态下crash时,是在哪个函数里出错?
- 为何现在招聘岗位都不要VC++(MFC)???
- 请问STDAPI 定义在哪个.h中,还有类似于STDAPI_(ULONG) STDAPI_(UINT) STDAPI_(TYPE)
- 继续FTP服务测试,不限速,不限线程,越多越好,欢迎上传...
- 怎样让函数返回CStringArray?
- 关于BMP的逻辑坐标
- 急问串口通信问题
- unicode UTF8 GBK
- MFC新建TOOLBAR位图只有4位的问题
UpdateData(TRUE);
我只有一根公的串口线,我把2,3脚短接了,然后想看发出的数据,如果加上UpdateData(TRUE),编辑框里什么显示都没有,
关联成 一个 m_radio 才是 0,9