我用mscomm和teechart做了一个数据串口通信实时通信软件 但是在用信号发生器实验时出现
comm.exe 中的 0x77266344 处有未经处理的异常: 0xC0000005: Access violation,下面是代码 求助!谢谢!
void CCommDlg::OnComm()
{
if(stop)return;
VARIANT m_input1;
COleSafeArray m_input2;
long length,i;
BYTE data[600];
CString str;
if(m_Comm.GetCommEvent()==2)//接收缓冲区内有字符
{
m_input1=m_Comm.GetInput();//读取缓冲区内的数据
m_input2=m_input1;//将VARIANT型变量转换为ColeSafeArray型变量
length=m_input2.GetOneDimSize();//确定数据长度
for(i=0;i<length;i++)
m_input2.GetElement(&i,data+i);//将数据转换为BYTE型数组 for(i=0;i<length;i++)//将数组转换为Cstring型变量
{
CFile file;
CString tempstr;
BYTE a=* (char *)(data+i);
BYTE b=* (char *)(data+(++i));
float c=(float)a+(float)(b%10)/10;
str.Format("%2.1f ",c);//将a格式化
if (str.GetLength()<5) str="0"+str;
str = str.Right(5);
调试停在这里 m_ReceiveData+=tempstr;//将刚采集的数加到编辑框中
//LineHight[121]=a;
Display();//对数据显示前的处理
//将数据保存到文件中
if (m_ReceiveData.GetLength()>=600)//600个字符刚好对应120个数据
{
CStdioFile readfile;
CString readstr,readstr2;
if(readfile.Open(FilePath,CFile::modeRead))
{
while(readfile.ReadString(readstr))//逐行查询,至到文件尾
{
readstr2+=readstr;
}
readfile.Close();
} if (file.Open(FilePath,CFile::modeCreate|CFile::modeReadWrite))
{
file.Write(readstr2,readstr2.GetLength());//原来的数据
file.Write(m_ReceiveData,600);//写入新的120个数据
file.Close();
m_ReceiveData="";//清除编辑框内容
break;
}
}
}
}
UpdateData(FALSE);//更新编辑框内容
}
“comm.exe”: 已加载“C:\Users\user\Desktop\串口\串口温度数据采集并实时显示\src\Debug\comm.exe”,已加载符号。
“comm.exe”: 已加载“C:\Windows\System32\ntdll.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\kernel32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\KernelBase.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\mfc100d.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\msvcr100d.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\user32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\gdi32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\lpk.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\usp10.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\msvcrt.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\shlwapi.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16661_none_ebfb56996c72aefc\comctl32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\advapi32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\sechost.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\rpcrt4.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\msimg32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\oleaut32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\ole32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\apphelp.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\AppPatch\AcLayers.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\sspicli.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\shell32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\userenv.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\profapi.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\winspool.drv”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\mpr.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\AppPatch\AcGenral.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\uxtheme.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\winmm.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\samcli.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\msacm32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\version.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\sfc.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\sfc_os.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\dwmapi.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\setupapi.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\cfgmgr32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\devobj.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\urlmon.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\wininet.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\iertutil.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\crypt32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\msasn1.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\AppPatch\AcXtrnal.dll”,Cannot find or open the PDB file
FTH: (7348): *** Fault tolerant heap shim applied to current process. This is usually due to previous crashes. ***
“comm.exe”: 已加载“ImageAtBase0x220000”,“包括”/“排除”设置禁用了加载功能。
“comm.exe”: 已卸载“ImageAtBase0x220000”
“comm.exe”: 已加载“C:\Windows\System32\shunimpl.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\SortServer2003Compat.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\imm32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\msctf.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\mfc100chs.dll”,未使用调试信息生成二进制文件。
“comm.exe”: 已加载“E:\Program Files\safemon\safemon.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\msvcp60.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\psapi.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\ws2_32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\nsi.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16661_none_420fe3fa2b8113bd\comctl32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\cryptbase.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\clbcatq.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\MSCOMM32.OCX”,无法找到或打开所需的 DBG 文件。
“comm.exe”: 已加载“C:\Windows\System32\sxs.dll”,Cannot find or open the PDB file
comm.exe 中的 0x7585e10a 处最可能的异常: 0xC0000005: 读取位置 0x003d0480 时发生访问冲突
comm.exe 中的 0x7585e10a 处有未经处理的异常: 0xC0000005: 读取位置 0x003d0480 时发生访问冲突
comm.exe 中的 0x77266344 处有未经处理的异常: 0xC0000005: Access violation,下面是代码 求助!谢谢!
void CCommDlg::OnComm()
{
if(stop)return;
VARIANT m_input1;
COleSafeArray m_input2;
long length,i;
BYTE data[600];
CString str;
if(m_Comm.GetCommEvent()==2)//接收缓冲区内有字符
{
m_input1=m_Comm.GetInput();//读取缓冲区内的数据
m_input2=m_input1;//将VARIANT型变量转换为ColeSafeArray型变量
length=m_input2.GetOneDimSize();//确定数据长度
for(i=0;i<length;i++)
m_input2.GetElement(&i,data+i);//将数据转换为BYTE型数组 for(i=0;i<length;i++)//将数组转换为Cstring型变量
{
CFile file;
CString tempstr;
BYTE a=* (char *)(data+i);
BYTE b=* (char *)(data+(++i));
float c=(float)a+(float)(b%10)/10;
str.Format("%2.1f ",c);//将a格式化
if (str.GetLength()<5) str="0"+str;
str = str.Right(5);
调试停在这里 m_ReceiveData+=tempstr;//将刚采集的数加到编辑框中
//LineHight[121]=a;
Display();//对数据显示前的处理
//将数据保存到文件中
if (m_ReceiveData.GetLength()>=600)//600个字符刚好对应120个数据
{
CStdioFile readfile;
CString readstr,readstr2;
if(readfile.Open(FilePath,CFile::modeRead))
{
while(readfile.ReadString(readstr))//逐行查询,至到文件尾
{
readstr2+=readstr;
}
readfile.Close();
} if (file.Open(FilePath,CFile::modeCreate|CFile::modeReadWrite))
{
file.Write(readstr2,readstr2.GetLength());//原来的数据
file.Write(m_ReceiveData,600);//写入新的120个数据
file.Close();
m_ReceiveData="";//清除编辑框内容
break;
}
}
}
}
UpdateData(FALSE);//更新编辑框内容
}
“comm.exe”: 已加载“C:\Users\user\Desktop\串口\串口温度数据采集并实时显示\src\Debug\comm.exe”,已加载符号。
“comm.exe”: 已加载“C:\Windows\System32\ntdll.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\kernel32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\KernelBase.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\mfc100d.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\msvcr100d.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\user32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\gdi32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\lpk.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\usp10.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\msvcrt.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\shlwapi.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16661_none_ebfb56996c72aefc\comctl32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\advapi32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\sechost.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\rpcrt4.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\msimg32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\oleaut32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\ole32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\apphelp.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\AppPatch\AcLayers.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\sspicli.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\shell32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\userenv.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\profapi.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\winspool.drv”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\mpr.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\AppPatch\AcGenral.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\uxtheme.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\winmm.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\samcli.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\msacm32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\version.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\sfc.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\sfc_os.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\dwmapi.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\setupapi.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\cfgmgr32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\devobj.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\urlmon.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\wininet.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\iertutil.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\crypt32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\msasn1.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\AppPatch\AcXtrnal.dll”,Cannot find or open the PDB file
FTH: (7348): *** Fault tolerant heap shim applied to current process. This is usually due to previous crashes. ***
“comm.exe”: 已加载“ImageAtBase0x220000”,“包括”/“排除”设置禁用了加载功能。
“comm.exe”: 已卸载“ImageAtBase0x220000”
“comm.exe”: 已加载“C:\Windows\System32\shunimpl.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\SortServer2003Compat.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\imm32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\msctf.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\mfc100chs.dll”,未使用调试信息生成二进制文件。
“comm.exe”: 已加载“E:\Program Files\safemon\safemon.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\msvcp60.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\psapi.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\ws2_32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\nsi.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16661_none_420fe3fa2b8113bd\comctl32.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\cryptbase.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\clbcatq.dll”,Cannot find or open the PDB file
“comm.exe”: 已加载“C:\Windows\System32\MSCOMM32.OCX”,无法找到或打开所需的 DBG 文件。
“comm.exe”: 已加载“C:\Windows\System32\sxs.dll”,Cannot find or open the PDB file
comm.exe 中的 0x7585e10a 处最可能的异常: 0xC0000005: 读取位置 0x003d0480 时发生访问冲突
comm.exe 中的 0x7585e10a 处有未经处理的异常: 0xC0000005: 读取位置 0x003d0480 时发生访问冲突
解决方案 »
- 求用斜线填充矩形函数
- 关于登录界面的问题:为什么无法从数据库里正确获取密码??
- 关于HookApi的
- 菜鸟积分太少,不能多给您分了,但还是请教大家:vc中怎样测量两个相同事件之间的时间间隔,这两个事件的捕捉识别没问题
- 菜鸟问题:如何通过AfxMessageBox()或MessageBox()显示一个int值,
- 关于BSTR,TCHAR,WCHAR,CHAR,CComVariant,CComBSTR,SysAllocString, SysFrssString急!!!
- 高分求解!
- Windwos API, WC_LISTVIEW 插入元组成功却显示不了?
- 求教各位,我用CSplitterWnd来分割窗口,但我不想让用户改变分割的大小或比例,该在那个消息中处理呢?
- MFC 用向导添加WM_CLOSE消息,会生成OnClose函数,如何在这个函数中获取WM_CLOSE的WPARAM和LPARAM参数
- 多线程通信
- 【求助】关于断电开电计数问题,谢谢大家:)
能告诉我具体的解决方法吗
friend CStringT operator+(
_In_ const CStringT& str1,
_In_ const CStringT& str2)
{
CStringT strResult( str1.GetManager() );调试停在这句 Concatenate( strResult, str1, str1.GetLength(), str2, str2.GetLength() ); return( strResult );
}输出:> comm.exe!ATL::operator+(const ATL::CStringT<char,StrTraitMFC_DLL<char,ATL::ChTraitsCRT<char> > > & str1="0?", const ATL::CStringT<char,StrTraitMFC_DLL<char,ATL::ChTraitsCRT<char> > > & str2={...}) 行 2295 + 0xb 字节 C++
跪求帮助!
求助!大侠 请问到底问题出在哪里 ?是与通信协议有关吗?跪求