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