本帖最后由 作者 于 2008-4-10 13:56:24 编辑
我从ObjectARX 2008的 例子 docman project 拷贝了几个函数如下: void newSyncDocHelper( void *pData) { if (acDocManager->isApplicationContext()) { const TCHAR * fileName = (const TCHAR *)pData; Acad::ErrorStatus es = acDocManager->appContextNewDocument(fileName); assert(es == Acad::eOk); } else assert(0 && "\nERROR: in Document context"); }
void openSyncDocHelper( void *pData) { if (acDocManager->isApplicationContext()) { const TCHAR * fileName = (const TCHAR *)pData; Acad::ErrorStatus es = acDocManager->appContextOpenDocument(fileName); assert(es == Acad::eOk); } else assert(0 && "ERROR: in Document context."); }
openSyncDoc() { static TCHAR pData[] = _T(/*NOXLATE*/"test1.dwg");
AcApDocument* pDoc = acDocManager->curDocument(); if (pDoc) { acutPrintf(_T("\nCurrently in Document context : %s, Switching to App.\n"),pDoc->fileName()); acDocManager->executeInApplicationContext(openSyncDocHelper, (void *)pData); } }
void newSyncDoc() { static TCHAR pData[] = _T(/*NOXLATE*/"acad.dwt");
AcApDocument* pDoc = acDocManager->curDocument(); if (pDoc) { acutPrintf(_T("\nCurrently in Document context : %s, Switching to App.\n"),pDoc->fileName()); acDocManager->executeInApplicationContext(newSyncDocHelper, (void *)pData); } } 当我在我的项目里面用这几个函数时, 当调用 openSyncDoc()时 acDocManager->appContextOpenDocument()是正常的返回Acad::eOK. 但调用newSyncDoc()时 acDocManager->appContextNewDocument()返回的却一直是Acad::eFilerError. 不知道是怎么回事。 Can you help me? thanks.
|