看了很多代码,感觉在vb中只要定义Dim retVal() As AcadEntity,就可以调用CopyObjects,可是在c++中第一个参数是VARIANT*,到底怎样才能把CAcadEntity数组转化为VARIANT*呢?我现在使用的是: CComVariant var1; var1.vt=VT_DISPATCH|VT_ARRAY; SAFEARRAYBOUND rgsabound[1]; rgsabound[0].cElements=num2; rgsabound[0].lLbound=0; var1.parray=SafeArrayCreate(VT_VARIANT,1,rgsabound); for(long j=0;j<num2;j++) { LPDISPATCH entity=m_acadDoc.ObjectIdToObject(m_acadList.at(j)); SafeArrayPutElement(var1.parray,&j,&entity); } 提出出错,到底该怎么办呢?非常感谢,着急ing |