acDocManager->executeInApplicationContext(writedwg, (void *)pDwgfile); 
if (acDocManager->isApplicationContext())
{
if(acDocManager->appContextOpenDocument((const char *)pDwgfile)==0)
{pDoc1 = acDocManager->curDocument();
if(acDocManager->enableDocumentActivation() != 0) AfxMessageBox("error");
if(acDocManager->setCurDocument(pDoc1,AcAp::kNone,Adesk::kTrue)!=0) AfxMessageBox("error");}使用上述方法打开文件后,在enableDocumentActivation,setCurDocument设置当前图档时出错。那样应当怎样设置呢?原有方法只有pDoc1 = acDocManager->curDocument();,在使用acedCommand向图档写入text时写入到运行该程序之前打开的活动图档(drawing1)上,没有写到新打开的图档上。请问是什么原因?acedCommand命令使用时是否有此方面的限制。