首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

Unhandled exception in *exe(MFC042D.dll):0xC0000005:Access violation,该如何处理

2012-01-15 
Unhandled exception in **.exe(MFC042D.dll):0xC0000005:Access violation小弟刚学VC不久,现在在学习一个

Unhandled exception in **.exe(MFC042D.dll):0xC0000005:Access violation
小弟刚学VC不久,现在在学习一个工程的时候卡在一个错误上了,下面是出错的部分代码:
bool CDiCom4K::Init(short ComNo,CString ComSet,CWnd* pParent,int ID)
{  
BSTR bStrLicense = ::SysAllocStringLen(pwchLicenseKey,sizeof(pwchLicenseKey)/sizeof(WCHAR));
Create(NULL,0,CRect(0,0,0,0),pParent,ID,NULL,FALSE,bStrLicense);//这个Create() 函数是用来创建一个串口控件的
::SysFreeString(bStrLicense);
SetCommPort(ComNo);
SetSettings(ComSet);
SetInBufferSize(1024);
SetInBufferCount(0);
SetInputMode(1);
SetRThreshold(1);
SetInputLen(0);
...(以下省略)


BOOL CDetect::OnInitDialog() 
{
CDialog::OnInitDialog();
RgsPath="Software\\VB and VBA Program Settings\\VehicleDetect\\Database";
m_Vehicle.Clear();
pApp=(CVcleDApp*)AfxGetApp();
if (m_DiCom4K.Init(pApp->ComNo,pApp->ComParam,this,IDC_MSCOMM1))
...(以下省略)
第二段程序代码是工程中调用Init()函数的部分.
程序运行到第一段程序的Create()函数的时候就崩溃了,然后弹出一个对话框
Unhandled exception in **.exe(MFC042D.dll):0xC0000005:Access violation
请问大侠们这是什么错误啊?在线等,困扰我好久了,55555....


[解决办法]
attach到一个用到它的进程中,就可以调了,
你可以把代码发给我,我帮你调试一下
gw_net@163.com

热点排行