CLSID StringToCLSID(const std::wstring &str) //------------------------------------------ { CLSID clsid = CLSID(); std::vector<OLECHAR> tmp(str.c_str(), str.c_str() + str.length() + 1); if(::CLSIDFromString(&tmp[0], &clsid) != S_OK) { return CLSID(); } return clsid; }
bool IsCLSID(const std::wstring &str) //----------------------------------- { CLSID clsid = CLSID(); std::vector<OLECHAR> tmp(str.c_str(), str.c_str() + str.length() + 1); return (::CLSIDFromString(&tmp[0], &clsid) == S_OK); }
CLSID CodecInfo::__GetCodecClass(UINT32 unIndex, PROPID propId) { PropertyVariant propVariant = m_codecLibrary.GetMethodProperty( unIndex, propId); switch (propVariant.vt) { case VT_BSTR: return *reinterpret_cast<const GUID *>(propVariant.bstrVal); case VT_EMPTY: return CLSID(); default: throw LibraryException("Cannot get the codec class."); } }