hello
I want to insert a picture into word document and Converts it to a free-floating shape , The method of ConvertToShape return NULL pointer of shapeptr. But the picture has been converted into free-floating shape. Because the pointer is null , so I can't do anything with the free-floating shape! the folowing is my source code , is any problem with my source code? thanks !!
Word::SelectionPtr spSelection = m_pApp->Selection;
Word::InlineShapesPtr spInlineShapes = spSelection->InlineShapes;
Word::InlineShapePtr spInlineShape;
COleVariant vtTrue((short)VARIANT_TRUE);
COleVariant vtFalse((short)VARIANT_FALSE);
spInlineShape = spInlineShapes->AddPicture(_bstr_t(lpPicFile), vtFalse, vtTrue);
if (NULL != spInlineShape) {
ShapePtr shape = spInlineShape->ConvertToShape();
if (shape != NULL) {
shape->ZOrder(msoSendBehindText);
}
}