using addpolyline in powerpoint

P

pho

I tried to create a safearray to be used in addpolyline method in
powerpoinr with the following code:

float iData;
SAFEARRAY *pSA;

SAFEARRAYBOUND aDim[2];
long iDims[2];

aDim[0].lLbound= 0;
aDim[0].cElements= 2;
aDim[1].lLbound= 0;
aDim[1].cElements= 2;

pSA= SafeArrayCreate(VT_R4,2,aDim);

iDims[0] = 0;
iDims[1] = 0;
iData = 10.0;
SafeArrayPutElement(pSA, iDims, (LPVOID ) &iData);

iDims[0] = 0;
iDims[1] = 1;
iData = 10.0;
SafeArrayPutElement(pSA, iDims, (LPVOID ) &iData);

iDims[0] = 1;
iDims[1] = 0;
iData = 100.0;
SafeArrayPutElement(pSA, iDims, (LPVOID ) &iData);

iDims[0] = 1;
iDims[1] = 1;
iData = 100.0;
SafeArrayPutElement(pSA, iDims, (LPVOID ) &iData);

VARIANT v;

VariantInit(&v);
v.vt = VT_BYREF|VT_ARRAY;
v.pparray = &pSA;

shapes.AddPolyline(v);

I got a "specified value is out of range" error message and don't know
what went wrong.

Thanks for the help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top