释放打开的CAD数据库出错
{AcDbDatabase* pDbb = acdbHostApplicationServices()->workingDatabase();
AcDbDatabase* pDb = new AcDbDatabase(false, false);
if (pDb->readDwgFile(m_strPath) != Acad::eOk)
{
MessageBox(_T("读取dwg文件出错!"));
return;
}
// 指定打开的文件为默认库
acdbHostApplicationServices()->setWorkingDatabase(pDb);
// 指定选择的数据库的当前布局
es=acdbHostApplicationServices()->layoutManager()->setCurrentLayout(_T("布局3"));
if(es!=Acad::eOk)
{
MessageBox(_T("布局指定失败"),_T(""),MB_OK);
}
......
// 切换回默认的数据库
acdbHostApplicationServices()->setWorkingDatabase(pDbb);
es=acdbHostApplicationServices()->layoutManager()->setCurrentLayout(_T("模型"));
// 删除打开的数据库 报错
delete pDb
} <p>由于我要读取打开文件的布局内容所以用了</p>
<p>acdbHostApplicationServices()->layoutManager()->setCurrentLayout(_T("布局3"));</p>
<p>导致后面的释放就报错了,如果不选择布局释放时则正常</p>
<p>不知道什么原因?</p> <p>没有人读取过布局内容吗</p>
页:
[1]