|
|
I used the template from the WMP SDK for Visual Studio for a Metadata UI Plugin. I was able to make a little area with a button I could click and have the metadata written to a file on the computer. However, I want this to automatically happen whenever a song plays. Nothing I seem to be able to do within the CPluginwindow.cpp seems to be able to affect anything outside that little box that it creates.
So, within my main file, called search.cpp, I left it exactly the same except that I added the following: (any typoes are irrelevant - I don't have access to that computer right now, so I'm copying it off a printout. It compiles, so ignore typeos)
BOOL CSearch::IsPlaying() { WMPPlayState state; if(m_spCore) { m_spCore->get_playState(&state); if(state == wmppsPlaying) { USES_CONVERSION; HRESULT hr; CComBSTR bstrValue; CComBSTR bstrName; CComPtr<IWMPMedia> spMedia; hr = m_spCore->get_currentMedia(&spMedia); if(SUCCEEDED(hr) && spMedia) { long lCount = 0; spMedia->get_attributesCount(&lCount); FILE *fp=0; fp = _tfopen(_T("my file page and filename"), _T("a+")); if(fp) { _ftprintf(fp, _T("*****\n")) for(long i = 0; i <= lCount; i++) { spMedia->getAttributeName(i, &bstrName); spMedia->getItemInfo(bstrName, &bstrValue); _ftprintf(fp, _T("%s : %s \n"), OLE2T(bstrName), OLE2T (bstrValue)); } _ftprintf(fp, _T("**** \n")); fclose(fp); } } } } return true; }
This doesn't do anything when I run the plugin. I realize why - nothing is calling it! How do I get WMP to call this every time a file is played? I have been trying to figure this out for WEEKS! Any help would be greatly appreciated!
|
|
|