activeX中GetBoundingBox的怪问题
<p>用VC++7,VC++8开发activex方式autocad想获得IAcadBlockReference 的 大小,碰到一个怪问题:</p><p>来操作AutoCAD2004的时候,一切正常,来操作AutoCAD2007的时候,却得不到结果:代码如下:</p><p>void GetBlockWidthAndHeight(double* width, double* height, AutoCAD::IAcadBlockReference *pblkRef)<br/>{<br/> VARIANT minPoint, maxPoint;<br/> double* pMaxData = NULL,* pMinData = NULL;<br/> HRESULT hr;<br/> SAFEARRAYBOUND minBound, maxBound;</p><p> VariantInit(&minPoint);<br/> VariantInit(&maxPoint);</p><p> minBound.lLbound = 0;<br/> minBound.cElements = 3;<br/> maxBound.lLbound = 0;<br/> maxBound.cElements = 3;</p><p> minPoint.vt = VT_ARRAY | VT_R8;<br/> maxPoint.vt = VT_ARRAY | VT_R8;<br/> minPoint.parray = SafeArrayCreate(VT_R8, 1, minBound);<br/> maxPoint.parray = SafeArrayCreate(VT_R8, 1, maxBound);</p><p> hr = pblkRef->GetBoundingBox(&minPoint, &maxPoint);<br/> hr = SafeArrayAccessData(minPoint.parray, (void**)&pMinData);<br/> hr = SafeArrayAccessData(maxPoint.parray, (void**)&pMaxData);</p><p> *width = pMaxData - pMinData;<br/> *height = pMaxData - pMinData;</p><p> hr = SafeArrayUnaccessData(minPoint.parray);<br/> hr = SafeArrayUnaccessData(maxPoint.parray);<br/>}</p><p>操作AutoCAD2007的时候,hr = pblkRef->GetBoundingBox(&minPoint, &maxPoint); 之后,minPoint和maxPoint均变成:VT_EMPTY了,请帮忙看看什么原因<br/></p><p></p>
页:
[1]