void CSifuDlg::OnLocked() //加锁 { // TODO: Add your control notification handler code here if(m_cLocked) { str2=0x04;} else { str2=0x00;}
}
void CSifuDlg::OnManualfoci() //调焦 { // TODO: Add your control notification handler code here if(m_cManualfoci) { if(m_cAugment) { str1=0x01;} if(m_cMinish) { str1=0x02;} else { str1=0x00;} } else { str1=0x03;}
} void CSifuDlg::OnTelemete() //测距 { // TODO: Add your control notification handler code here if(m_cTelemete) { str3=0x80;} else { str3=0x00;}
} void CSifuDlg::OnSend(CString &str, int Port) //发送 { // TODO: Add your control notification handler code here CString strdata; strdata=str1|str2|str3; if(!m_bConnect) return; UpdateData(TRUE); m_SerialPort.WriteToPort((LPCTSTR)strdata);
} 调试的时候出现错误: D:\Sifu\SifuDlg.cpp(326) : warning C4305: '=' : truncation from 'const int' to 'char' D:\Sifu\SifuDlg.cpp(326) : warning C4309: '=' : truncation of constant value D:\Sifu\SifuDlg.cpp(338) : error C2664: 'WriteToPort' : cannot convert parameter 1 from 'const char *' to 'char *' Conversion loses qualifiers Error executing cl.exe.
Sifu.exe - 1 error(s), 2 warning(s) 不知道怎么修改,那位会的帮帮忙,谢谢.
|