IltmmWMProfile::get_MutualExclusionCount Example for C++
For complete code, refer to the CNVWM demo.
// The example below checks all the streams for
// a mutual object. If the quality is less than 50,
// it is removed.
void SetupMutualObjects(IltmmWMProfile *pProfile)
{
USES_CONVERSION;
IltmmWMMutualExclusion *pMutualExc = NULL;
IltmmWMStreamConfig *pStreamConfig = NULL;
long lMCount;
long lSCount;
long lStreamNumber;
long lQuality;
BSTR bstrData;
char strUpdate[255];
pProfile->get_MutualExclusionCount (&lMCount);
// iterate through the objects
for(int i=0; i<lMCount; i++)
{
pProfile->GetMutualExclusion (i, &pMutualExc);
pMutualExc->get_StreamCount (&lSCount);
if(lSCount == 0)
{
pProfile->RemoveMutualExclusion (pMutualExc);
pMutualExc->Release();
}
else
{
for(int j=0; j<lSCount; j++)
{
// obtain the stream number
pMutualExc->GetStream (j, &lStreamNumber);
// get the stream using it's number
pProfile->GetStreamByNumber (lStreamNumber, &pStreamConfig);
// check it's quality, if it is less than 50, remove it...
pStreamConfig->get_Quality (&lQuality);
if(lQuality < 50)
{
// remove it...
pMutualExc->RemoveStream (lStreamNumber);
}
// report the user with update...
pMutualExc->get_Type (&bstrData);
sprintf(strUpdate, "Updating Mutual object with type :\n %s", OLE2A(bstrData));
SysFreeString(bstrData);
MessageBox(NULL, strUpdate, "Update...", MB_OK);
pStreamConfig->Release();
pMutualExc->Release();
}
}
}
}