V
vdoser
Hi there,
I'm using vc++ and visio automation to create a shape in an opened Visio
2003 doc.
this code works ok for a rectangle( Drawrectangle) but fails for a polyline:
CVPage visPage = m_visioApp.get_ActivePage();
if (visPage.m_lpDispatch)
{
SAFEARRAYBOUND sab;
sab.cElements = 6;
sab.lLbound = 0;
SAFEARRAY* psa = SafeArrayCreate(VT_R8, 1, &sab);
long idx[1];
double valX = 1;
double valY = 3;
for (int i = 0; i < 3 ; i++)
{
idx[0]= i;
SafeArrayPutElement(psaX,idx,&valX);
idx[0]+= 1;
SafeArrayPutElement(psaX,idx,&valY);
valX = valX + 1;
valY = valY + 1;
}
CVShape shape = visPage.DrawPolyline(&psaX, 0); -> "Access violation
writing location" exception
SafeArrayDestroy(psaX);
shape.ReleaseDispatch();
}
What might be wrong?
Any help would be appreiciated,
Serguei
I'm using vc++ and visio automation to create a shape in an opened Visio
2003 doc.
this code works ok for a rectangle( Drawrectangle) but fails for a polyline:
CVPage visPage = m_visioApp.get_ActivePage();
if (visPage.m_lpDispatch)
{
SAFEARRAYBOUND sab;
sab.cElements = 6;
sab.lLbound = 0;
SAFEARRAY* psa = SafeArrayCreate(VT_R8, 1, &sab);
long idx[1];
double valX = 1;
double valY = 3;
for (int i = 0; i < 3 ; i++)
{
idx[0]= i;
SafeArrayPutElement(psaX,idx,&valX);
idx[0]+= 1;
SafeArrayPutElement(psaX,idx,&valY);
valX = valX + 1;
valY = valY + 1;
}
CVShape shape = visPage.DrawPolyline(&psaX, 0); -> "Access violation
writing location" exception
SafeArrayDestroy(psaX);
shape.ReleaseDispatch();
}
What might be wrong?
Any help would be appreiciated,
Serguei