IltmmCaptureSubTypes::get_Count Example for C

IltmmCaptureSubTypes* pVideoCapSubTypes;
IltmmCaptureSubType*  pCapSubType;
long lCount, lSel, i;
VARIANT_BOOL bVar;
BSTR bstrName, bstrFriendName;

IltmmCapture__get_VideoCaptureSubTypes
(g_capture, (IltmmCaptureSubTypes**)&pVideoCapSubTypes);
IltmmCaptureSubTypes__get_Count
(pVideoCapSubTypes, &lCount);
if (lCount > 0)
{
   for (i = 0; i < lCount; i++)
   {
      IltmmCaptureSubTypes_Item(pVideoCapSubTypes, i, &pCapSubType);
      if (i == 1)
      {
         IltmmCaptureSubType__get_Name(pCapSubType, &bstrName);
         IltmmCaptureSubType__get_FriendlyName(pCapSubType, &bstrFriendName);
         IltmmCaptureSubType__get_Selected(pCapSubType, &bVar);
         if (bVar == VARIANT_TRUE)
            IltmmCaptureSubType__put_Selected(pCapSubType, VARIANT_FALSE);
      }
      IltmmCaptureSubType_Release(pCapSubType);
   }
   IltmmCaptureSubTypes__get_Selection(pVideoCapSubTypes, &lSel);
   if (lSel != 1)
   {
      IltmmCaptureSubTypes_Find(pVideoCapSubTypes, bstrName, &lSel);
      IltmmCaptureSubTypes__put_Selection(pVideoCapSubTypes, lSel);
   }
   SysFreeString(bstrName);
   SysFreeString(bstrFriendName);
}
IltmmCaptureSubTypes_Release(pVideoCapSubTypes);