The IVariantDictionary::get_Count method returns the number of items in either the Contents or StaticObjects collection.
HRESULT get_Count(
int*cStrRet // pointer to an integer containing the number of items
);
Application Contents Collection, Application StaticObjects Collection, Session Contents Collection, Session StaticObjects Collection