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