Thanks a lot! That is exactly what I need. Now I have another question. I tried to program user C++ instead of VB to set the animation properties of each image. Here is part of my code
......
// Get DISPID for the AnimationSettings method in Shape objec
szFunction = OLESTR("AnimationSettings")
hr = pDispShape->GetIDsOfNames(IID_NULL, &szFunction, 1, LOCALE_USER_DEFAULT, &dispid_ShpAnimSet)
// Invoke the AnimationSettings method in Shape objec
hr = pDispShape->Invoke(dispid_ShpAnimSet, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, &dpNoArgs, &vResult, &excep, NULL)
if(FAILED(hr)) PPTErrHandler(hr, excep);
// Get IDispatch* for the AnimationSettings objec
pDispAnimation = vResult.pdispVal
// Get DISPID for the Animate method on AnimationSettings objec
szFunction = OLESTR("Animate")
hr = pDispAnimation->GetIDsOfNames(IID_NULL, &szFunction, 1, LOCALE_USER_DEFAULT, &dispid_AnimAnimate)
// Prepare parameters for AnimationOrder metho
VARIANT vArgsAnm[1];
DISPPARAMS dpAnm;
vArgsAnm[0].vt = VT_I4; // Parameter type: lon
vArgsAnm[0].lVal = -1; // Animate = MsoTriState:msoTru
dpAnm.cArgs = 1; // Function takes 1 parameters
dpAnm.cNamedArgs = 0
dpAnm.rgvarg = vArgsAnm
// Invoke the TextLevelEffect method on AnimationSettings objec
hr = pDispAnimation->Invoke(dispid_AnimAnimate, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &dpAnm, &vResult, &excep, NULL)
......
The program always fail the last statement with error message: Member not found. Do you know what's wrong with my last statement? Thank you!