IModelDocExtension::FindTrackedObjects() method fails to return the tracked objects

Hello,

I have set the tracking ID to the output body of the macro feature in the regenerate callback.

Now I am trying to track that output body outside the regenerate callback. Below the code snippet:-

//==========================================//

long trackingCookie;

CComBSTR name(L"TrackingIDOfOutputBody");
m_pSwApp->RegisterTrackingDefinition(name, &trackingCookie);

CComPtr modelDoc;
m_pSwApp->get_IActiveDoc2(&modelDoc);
CComPtr modelDocExt;
modelDoc->get_Extension(&modelDocExt);
CComVariant objToSearch, filterTypes, trackedObjects;
modelDocExt->FindTrackedObjects(trackingCookie, nullptr, objToSearch, filterTypes, &trackedObjects);

//==========================================//

I have set the objToSearch, filtertypes to empty as per the information given in SolidWorks API help but didn't get the output body as trackedObjects for given trackingCookie.

Please let us know your views.

Thanks and Regards,

Mahadev

SolidworksApi/macros