我是纯业余的(可能问题都说不明白)
我用ObjectARX使用MFC编写了几个对话框,写了一些语句,想把计算结果直接输出到CAD模型空间中。
当我把   “    CString outStr14; 
    outStr14.Format(_T("%d"),m_Yb75_4DJZ1); 
AcGePoint3d ptInsert;
    ptInsert.set(112, 257, 0);
    CCreateTuKuang::Create1MText(ptInsert,outStr14);” 放到acrxEntryPoint.cpp中时,没有问题,可以正常输出计算结果。
而当我把   “    CString outStr14; 
    outStr14.Format(_T("%d"),m_Yb75_4DJZ1); 
AcGePoint3d ptInsert;
    ptInsert.set(112, 257, 0);
    CCreateTuKuang::Create1MText(ptInsert,outStr14);” 放到void CWELCOME::OnYb754()时,程序调试无错误,当CAD加载程序运行时出现中断。系统显示“acad.exe 中的 0x6458bd80 处最可能的异常: 0xC0000005: 读取位置 0x00000004 时发生访问冲突”
“下面的框架可能不正确或缺失,没有为acdb17.dll加载符号”。错误的位置就在“  pBlockTable->close();
  pBlockTableRecord->close();
  pEnt->close();”
AcDbObjectId CCreateTuKuang::CreateMText(const AcGePoint3d& ptInsert,const ACHAR* text, AcDbObjectId style,double height, double width)
{
  AcDbMText *pMText = new AcDbMText();
// 设置多行文字的特性
  pMText->setTextStyle(style);
  pMText->setContents(text);
  pMText->setLocation(ptInsert);
  pMText->setTextHeight(height);
  pMText->setWidth(width);
  pMText->setAttachment(AcDbMText::kTopMid);  return CCreateTuKuang::PostToModelSpace(pMText);}AcDbObjectId CCreateTuKuang::Create1MText(const AcGePoint3d& ptInsert,const ACHAR* text, AcDbObjectId style,double height, double width)
{
  AcDbMText *pMText = new AcDbMText();
// 设置多行文字的特性
  pMText->setTextStyle(style);
  pMText->setContents(text);
  pMText->setLocation(ptInsert);
  pMText->setTextHeight(height);
  pMText->setWidth(width);
  pMText->setAttachment(AcDbMText::kTopMid);   return CCreateTuKuang::PostToModelSpace(pMText);}void CWELCOME::OnYb754()
{
// TODO: 在此添加命令处理程序代码
//防止资源冲突
CAcModuleResourceOverride resOverride; CENTERYB75TJNUM Enteryb75TjNumDlg; if(Enteryb75TjNumDlg.DoModal()==IDOK)
{
 m_Yb75_TjNum=Enteryb75TjNumDlg.m_Yb75_TjNum;
} DJZ();//自定义函数 CString outStr14; 
    outStr14.Format(_T("%d"),m_Yb75_4DJZ1); 
AcGePoint3d ptInsert;
    ptInsert.set(112, 257, 0);
    CCreateTuKuang::Create1MText(ptInsert,outStr14);
}

解决方案 »

  1.   

    崩溃的时候在弹出的对话框按相应按钮进入调试,按Alt+7键查看Call Stack即“调用堆栈”里面从上到下列出的对应从里层到外层的函数调用历史。双击某一行可将光标定位到此次调用的源代码或汇编指令处,看不懂时双击下一行,直到能看懂为止
      

  2.   

    问题在 CCreateTuKuang::PostToModelSpace(pMText); 里头  
      

  3.   


    调试能通过,CAD加载程序的时候提示有问题,确实是这里有问题。求解决方法。拜托拜托了。。自学路上异常艰难。