Hi
Was wondering if somebody could help me. I have the below code and everything works fine until it gets to
store->GetValue(PKEY_Music_Artist, &variant);
m_strArtistsTag = variant.pwszVal;
and then it just crashes. I'm thinking it has something to do with .pwszVal. But not sure.
All the other store->GetValue's work perfectly
void CQueriesCheckTags::GetFileTags(CString strFilePath)
{
IPropertyStore* store = NULL;
PROPVARIANT variant;
if (m_FilePath.Right(4) == _T(".mp3"))
{
// initialize the COM library
CoInitialize(NULL);
HRESULT hr = SHGetPropertyStoreFromParsingName(m_FilePath,
NULL, GPS_READWRITE, __uuidof(IPropertyStore), (void**)&store);
if (hr != S_OK)
AfxMessageBox(m_FilePath);
store->GetValue(PKEY_Music_AlbumTitle, &variant);
m_strAlbumTitleTag = variant.pwszVal;
store->GetValue(PKEY_Title, &variant);
m_strSongTitleTag = variant.pwszVal;
store->GetValue(PKEY_Music_Artist, &variant);
m_strArtistsTag = variant.pwszVal;
store->GetValue(PKEY_Music_TrackNumber, &variant);
m_strTrackTag.Format(_T("%d"), variant.intVal);
//very important undocumented method
store->Release();
CoUninitialize();
}
}