[ARX]在下面的程序的pDisp = IDoc.GetModelSpace()处,为什么编译通不过哦!
#include "acad.h"<BR>// This is command 'COMCIRCLE'<BR>void testgroupcomcircle()<BR>{<BR> // TODO: Implement the command<BR> try<BR> {<BR> //声明变量<BR> IAcadApplication IApp;<BR> IAcadDocuments IDoc;<BR> IAcadModelSpace IMSpace;IDispatch *pDisp = acedGetAcadWinApp()->GetIDispatch(TRUE);<BR> IApp.AttachDispatch(pDisp);<BR> //取得活动的AutoCAD文档<BR> pDisp = IApp.GetActiveDocument();<BR> IDoc.AttachDispatch (pDisp);<BR> //取得文档中的模型空间对象<BR> pDisp = IDoc.GetModelSpace(); //<FONT color=#ee3d11 size=1>此处编译不能通过</FONT> IMSpace.AttachDispatch (pDisp);<BR> SAFEARRAYBOUND rgsaBound;<BR> rgsaBound.lLbound = 0L; //表示数组从0开始计数<BR> rgsaBound.cElements = 3; //共3个数组元素
long i;<BR> SAFEARRAY* pStartPoint = NULL;<BR> //建立一个SAFEARRAY,VT_R8表示double类型<BR> pStartPoint = SafeArrayCreate(VT_R8,1,&rgsaBound);<BR> //给数组的各元素赋值<BR> i = 0;<BR> double value = 4.0;<BR> SafeArrayPutElement(pStartPoint,&i,&value);<BR> i = 1;<BR> value = 2.0;<BR> SafeArrayPutElement(pStartPoint,&i,&value);<BR> i = 2;<BR> value = 0.0;<BR> SafeArrayPutElement(pStartPoint,&i,&value);<BR> //将pStartPoint存放到VARIANT pt1中<BR> VARIANT pt1;<BR> VariantInit(&pt1);<BR> V_VT(&pt1) = VT_ARRAY|VT_R8;<BR> V_ARRAY(&pt1) = pStartPoint;<BR> IMSpace.AddCircle (pt1,2.0);<BR> }<BR> catch(COleDispatchException e)<BR> {<BR> e.ReportError();<BR> e.Delete();<BR> }
}
页:
[1]