请教VC控制Word画曲线时AddPolyline的参数?
我用VC控制Word用AddPolyline画曲线失败,提示“指定的值超出了范围”,请教高手:AddPolyline的参数SafeArrayOfPoints这样做问题在哪里(代码如下)?
COleVariant vOpt((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
SAFEARRAY *coords;
VARIANT vcoords;
SAFEARRAYBOUND saBound[2];
saBound[0].lLbound = 0;
saBound[0].cElements = 3;
saBound[1].lLbound = 0;
saBound[1].cElements = 3;
coords = ::SafeArrayCreate(VT_I4, 2, saBound);
if (coords)
{
void HUGEP *pvData;
::SafeArrayAccessData(coords, (void **)&pvData);
long point[3][2];
point[0][0] = 0;
point[0][1] = 10;
point[1][0] = 10;
point[1][1] = 20;
point[2][0] = 20;
point[2][1] = 30;
memcpy(pvData, point, 2 * 3 * sizeof(long));
::SafeArrayUnaccessData(coords);
VariantInit(&vcoords);
V_VT(&vcoords) = VT_SAFEARRAY | VT_ARRAY;
V_ARRAY(&vcoords) = coords;
oShape = oShapes.AddPolyline(&vcoords, vOpt); // 这里出错
...
}
谢谢!
[解决办法]
你能把与之相关的完整的程序(该程序所在的函数,不是整休程序哟)贴出来吗?这样才好和你一起调啊!