IltmmWMProfile::get_Version Example for C
For complete code, refer to the CNVWM demo.
BOOL DisplaySystemProfiles()
{
// ATL Macro
USES_CONVERSION;
long count = 0;
long streamCount = 0;
long versionNum = 0;
long lVersion;
char data[10];
IltmmWMProfile *pProfile = NULL;
IltmmWMProfileManager *pProfileManager = NULL;
BSTR bstrString;
int i;
// Create a profile manager
HRESULT hr = CoCreateInstance(&CLSID_ltmmWMProfileManager, NULL, CLSCTX_INPROC_SERVER, &IID_IltmmWMProfileManager, (void**) &pProfileManager);
if(FAILED(hr))
{
return TRUE;
}
// show only system profiles for version ltmmWMT_VER_4_0
IltmmWMProfileManager__get_SystemProfileVersion(pProfileManager, &lVersion);
if(lVersion != ltmmWMT_VER_4_0)
{
IltmmWMProfileManager_Release(pProfileManager);
return TRUE;
}
hr = IltmmWMProfileManager__get_SystemProfileCount(pProfileManager, &count);
if(FAILED(hr))
{
IltmmWMProfileManager_Release(pProfileManager);
return TRUE;
}
for(i = 0; i < count; i++)
{
hr = IltmmWMProfileManager_LoadSystemProfile(pProfileManager, i, &pProfile);
if(FAILED(hr))
{
IltmmWMProfileManager_Release(pProfileManager);
return TRUE;
}
// Display the name
IltmmWMProfile__get_Name(pProfile, &bstrString);
cout << OLE2A(bstrString);
SysFreeString(bstrString);
// Add the description, version and the stream count
IltmmWMProfile__get_Description(pProfile, &bstrString);
cout << OLE2A(bstrString);
SysFreeString(bstrString);
IltmmWMProfile__get_Version(pProfile, &versionNum);
switch(versionNum)
{
case ltmmWMT_VER_4_0:
cout << "ltmmWMT_VER_4_0";
break;
case ltmmWMT_VER_7_0:
cout << "ltmmWMT_VER_7_0";
break;
case ltmmWMT_VER_8_0:
cout << "ltmmWMT_VER_8_0";
break;
case ltmmWMT_VER_9_0:
cout << "ltmmWMT_VER_9_0";
break;
default:
cout << "UNKNOWN";
break;
};
// Display the number of streams
IltmmWMProfile__get_StreamCount(pProfile, &streamCount);
cout << ltoa(streamCount, data, 10);
IltmmWMProfile_Release(pProfile);
pProfile = NULL;
}
IltmmWMProfileManager_Release(pProfileManager);
pProfileManager = NULL;
return TRUE;
}