关于怎样删除一个DWG文件
<P>void OpenDoc( void *pData);</P><P>int COpDwg_OpenOtherDwg(CString strNewFileName)<BR>{<BR> SErrorInfo errInfo;<BR> struct resbuf resSysVal;<BR> bool bTmp;<BR> AcApDocument* pDoc; </P>
<P> try<BR> {<BR> //Early work<BR> errInfo.strCallFuncName = "COpDwg_OpenOtherDwg";<BR> <BR> strNewFileName.TrimLeft();<BR> strNewFileName.TrimRight();<BR> //システム変数初期设定(SDI)<BR> CSysDa_InitThisVal("SDI",false,resSysVal);<BR> //一时的にMDIモードに设定する(SDIモードだとファイルをオープンする际に例外発生)<BR> CSysDa_SetSysValue(0, true, bTmp);</P>
<P> pDoc = acDocManager->curDocument(); <BR> acDocManager->activateDocument(pDoc, Adesk::kTrue); <BR> if(bSave == true)<BR> {<BR> acDocManager->sendStringToExecute( pDoc, "(vl-load-com)(vl-cmdf \"vbastmt\" (strcat \"ThisDrawing.Close True\"))\n",<BR> false, true);</P>
<P> }<BR> else<BR> {<BR> acDocManager->sendStringToExecute( pDoc, "(vl-load-com)(vl-cmdf \"vbastmt\" (strcat \"ThisDrawing.Close False\"))\n",<BR> false, true);</P>
<P> }<BR> pDoc = NULL;<BR> pDoc = acDocManager->curDocument(); <BR> acDocManager->activateDocument(pDoc, Adesk::kTrue); <BR> acDocManager->executeInApplicationContext(OpenDoc, (void *)(LPSTR)(LPCTSTR)strNewFileName);<BR> return RTN_TRUE;<BR> }<BR> catch(...)<BR> {<BR> errInfo.strErrMsg = ERR_MSG_EXCEPTION;<BR> goto SystemError;<BR> }</P>
<P>SystemError:<BR> CError_WriteErrlog(errInfo);<BR> return RTN_SYSERR; <BR>}</P>
<P>void OpenDoc( void *pData)<BR>{<BR> AcApDocument* pDoc = acDocManager->curDocument();</P>
<P> if (acDocManager->isApplicationContext()) <BR> {<BR> acDocManager->appContextOpenDocument((const char *)pData);<BR> } <BR> else<BR> {<BR> acutPrintf("\nERROR To Open Doc!\n");<BR> }<BR>}</P>
<P>憋了这么多天终于有了点眉目,这段代码想要实现的功能是:将当前活动文件删除,并以strNewFileName路径名打开一个文件.现在在执行了sendStringToExecute后,再执行executeInApplicationContext,就会出现异常,我很不理解,还请哪位高手多多指点一下呀</P>
页:
[1]