本帖最后由 作者 于 2009-5-18 21:47:38 编辑
void CloseActiveDocument() { IAcadApplication IApp; IAcadDocument IDoc; IDispatch *pDisp = acedGetAcadWinApp()-> GetIDispatch(TRUE); //AddRef is called on the pointer IApp.AttachDispatch(pDisp); // does not call AddRef() IApp.SetVisible(true); pDisp = IApp.GetActiveDocument(); //AddRef is called IDoc.AttachDispatch(pDisp); VARIANT saveChanges, fileName; saveChanges.vt = VT_BOOL; saveChanges.boolVal = VARIANT_TRUE; fileName.vt = VT_ERROR; fileName.scode = DISP_E_PARAMNOTFOUND; IDoc.Close(saveChanges, fileName); return; } 怎么不能关闭当前文档,反而报错 弹出一对话框 说什么“未处理的异常 等。。。” |