本文整理汇总了C++中IPropertyStore::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyStore::GetCount方法的具体用法?C++ IPropertyStore::GetCount怎么用?C++ IPropertyStore::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyStore
的用法示例。
在下文中一共展示了IPropertyStore::GetCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
CLSID wid;
CoInitialize(NULL);
CLSIDFromString(const_cast<wchar_t*>(default_guid), &wid);
IInitializeWithFile *oo;
HRESULT hr;
if ((hr = CoCreateInstance(wid, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&oo))) != S_OK)
fail();
#if 0
IStorage *isto;
if ((hr = StgCreateDocfile(L"t.mp3", STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DIRECT, 0, &isto)) != S_OK)
fail();
IStream *is;
if ((hr = isto->CreateStream(L"lol", STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &is)) != S_OK)
fail();
#endif
IPropertyStore *ips;
IPropertyStoreCapabilities *ipcs;
if ((hr = oo->QueryInterface(IID_PPV_ARGS(&ips))) != S_OK)
fail();
if ((hr = oo->QueryInterface(IID_PPV_ARGS(&ipcs))) != S_OK)
fail();
//iws->Initialize(is, STGM_READWRITE);
if ((hr = oo->Initialize(L"t.mp3", STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DIRECT)) != S_OK)
fail();
DWORD props;
if ((hr = ips->GetCount(&props)) != S_OK)
fail();
for (DWORD i = 0; i < props; ++i)
{
PROPERTYKEY pkey;
ips->GetAt(i, &pkey);
WCHAR *sz;
PSGetNameFromPropertyKey(pkey, &sz);
std::wcout << (ipcs->IsPropertyWritable(pkey) == S_OK) << "\t" << sz << std::endl;
}
return 0;
}
示例2: EnumerateProperties
HRESULT EnumerateProperties(PCWSTR pszFilename)
{
IPropertyStore* pps = NULL;
// Call the helper to get the property store for the initialized item
// Note that as long as you have the property store, you are keeping the file open
// So always release it once you are done.
HRESULT hr = GetPropertyStore(pszFilename, GPS_DEFAULT, &pps);
if (SUCCEEDED(hr))
{
// Retrieve the number of properties stored in the item.
DWORD cProperties = 0;
hr = pps->GetCount(&cProperties);
if (SUCCEEDED(hr))
{
for (DWORD i = 0; i < cProperties; i++)
{
// Get the property key at a given index.
PROPERTYKEY key;
hr = pps->GetAt(i, &key);
if (SUCCEEDED(hr))
{
// Get the canonical name of the property
PWSTR pszCanonicalName = NULL;
hr = PSGetNameFromPropertyKey(key, &pszCanonicalName);
if (SUCCEEDED(hr))
{
hr = PrintProperty(pps, key, pszCanonicalName);
CoTaskMemFree(pszCanonicalName);
}
}
}
}
pps->Release();
}
else
{
wprintf(L"Error %x: getting the propertystore for the item.\n", hr);
}
return hr;
}
示例3: updateMetadata
void DirectShowMetaDataControl::updateMetadata(IFilterGraph2 *graph, IBaseFilter *source, const QString &fileSrc)
{
m_metadata.clear();
#ifndef QT_NO_SHELLITEM
if (!sHCreateItemFromParsingName) {
QSystemLibrary lib(QStringLiteral("shell32"));
sHCreateItemFromParsingName = (q_SHCreateItemFromParsingName)(lib.resolve("SHCreateItemFromParsingName"));
}
if (!fileSrc.isEmpty() && sHCreateItemFromParsingName) {
IShellItem2* shellItem = 0;
if (sHCreateItemFromParsingName(reinterpret_cast<const WCHAR*>(fileSrc.utf16()),
0, IID_PPV_ARGS(&shellItem)) == S_OK) {
IPropertyStore *pStore = 0;
if (shellItem->GetPropertyStore(GPS_DEFAULT, IID_PPV_ARGS(&pStore)) == S_OK) {
DWORD cProps;
if (SUCCEEDED(pStore->GetCount(&cProps))) {
for (DWORD i = 0; i < cProps; ++i)
{
PROPERTYKEY key;
PROPVARIANT var;
PropVariantInit(&var);
if (FAILED(pStore->GetAt(i, &key)))
continue;
if (FAILED(pStore->GetValue(key, &var)))
continue;
if (IsEqualPropertyKey(key, PKEY_Author)) {
m_metadata.insert(QMediaMetaData::Author, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Title)) {
m_metadata.insert(QMediaMetaData::Title, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Media_SubTitle)) {
m_metadata.insert(QMediaMetaData::SubTitle, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_ParentalRating)) {
m_metadata.insert(QMediaMetaData::ParentalRating, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Comment)) {
m_metadata.insert(QMediaMetaData::Description, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Copyright)) {
m_metadata.insert(QMediaMetaData::Copyright, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Media_ProviderStyle)) {
m_metadata.insert(QMediaMetaData::Genre, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Media_Year)) {
m_metadata.insert(QMediaMetaData::Year, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Media_DateEncoded)) {
m_metadata.insert(QMediaMetaData::Date, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Rating)) {
m_metadata.insert(QMediaMetaData::UserRating,
int((convertValue(var).toUInt() - 1) / qreal(98) * 100));
} else if (IsEqualPropertyKey(key, PKEY_Keywords)) {
m_metadata.insert(QMediaMetaData::Keywords, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Language)) {
m_metadata.insert(QMediaMetaData::Language, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Media_Publisher)) {
m_metadata.insert(QMediaMetaData::Publisher, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Media_Duration)) {
m_metadata.insert(QMediaMetaData::Duration,
(convertValue(var).toLongLong() + 10000) / 10000);
} else if (IsEqualPropertyKey(key, PKEY_Audio_EncodingBitrate)) {
m_metadata.insert(QMediaMetaData::AudioBitRate, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Media_AverageLevel)) {
m_metadata.insert(QMediaMetaData::AverageLevel, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Audio_ChannelCount)) {
m_metadata.insert(QMediaMetaData::ChannelCount, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Audio_PeakValue)) {
m_metadata.insert(QMediaMetaData::PeakValue, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Audio_SampleRate)) {
m_metadata.insert(QMediaMetaData::SampleRate, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Music_AlbumTitle)) {
m_metadata.insert(QMediaMetaData::AlbumTitle, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Music_AlbumArtist)) {
m_metadata.insert(QMediaMetaData::AlbumArtist, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Music_Artist)) {
m_metadata.insert(QMediaMetaData::ContributingArtist, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Music_Composer)) {
m_metadata.insert(QMediaMetaData::Composer, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Music_Conductor)) {
m_metadata.insert(QMediaMetaData::Conductor, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Music_Lyrics)) {
m_metadata.insert(QMediaMetaData::Lyrics, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Music_Mood)) {
m_metadata.insert(QMediaMetaData::Mood, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Music_TrackNumber)) {
m_metadata.insert(QMediaMetaData::TrackNumber, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Music_Genre)) {
m_metadata.insert(QMediaMetaData::Genre, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_ThumbnailStream)) {
m_metadata.insert(QMediaMetaData::ThumbnailImage, convertValue(var));
} else if (IsEqualPropertyKey(key, PKEY_Video_FrameHeight)) {
QSize res;
res.setHeight(convertValue(var).toUInt());
if (SUCCEEDED(pStore->GetValue(PKEY_Video_FrameWidth, &var)))
res.setWidth(convertValue(var).toUInt());
m_metadata.insert(QMediaMetaData::Resolution, res);
} else if (IsEqualPropertyKey(key, PKEY_Video_HorizontalAspectRatio)) {
QSize aspectRatio;
aspectRatio.setWidth(convertValue(var).toUInt());
if (SUCCEEDED(pStore->GetValue(PKEY_Video_VerticalAspectRatio, &var)))
aspectRatio.setHeight(convertValue(var).toUInt());
//.........这里部分代码省略.........