diff --git a/Plugins/PluginNowPlaying/NowPlaying.cpp b/Plugins/PluginNowPlaying/NowPlaying.cpp index 79ad3a69..c02829a4 100644 --- a/Plugins/PluginNowPlaying/NowPlaying.cpp +++ b/Plugins/PluginNowPlaying/NowPlaying.cpp @@ -273,7 +273,7 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id) */ void Finalize(HMODULE instance, UINT id) { - std::map::iterator i = g_Measures.find(id); + std::map::const_iterator i = g_Measures.find(id); if (i != g_Measures.end()) { ChildMeasure* child = (*i).second; @@ -304,7 +304,7 @@ void Finalize(HMODULE instance, UINT id) */ UINT Update(UINT id) { - std::map::iterator i = g_Measures.find(id); + std::map::const_iterator i = g_Measures.find(id); if (i != g_Measures.end()) { ChildMeasure* child = (*i).second; @@ -367,7 +367,7 @@ UINT Update(UINT id) */ LPCTSTR GetString(UINT id, UINT flags) { - std::map::iterator i = g_Measures.find(id); + std::map::const_iterator i = g_Measures.find(id); if (i != g_Measures.end()) { ChildMeasure* child = (*i).second; @@ -440,7 +440,7 @@ LPCTSTR GetString(UINT id, UINT flags) */ void ExecuteBang(LPCTSTR bang, UINT id) { - std::map::iterator i = g_Measures.find(id); + std::map::const_iterator i = g_Measures.find(id); if (i != g_Measures.end()) { ChildMeasure* child = (*i).second; diff --git a/Plugins/PluginNowPlaying/PlayerCAD.cpp b/Plugins/PluginNowPlaying/PlayerCAD.cpp index 7cb62c92..de1bda52 100644 --- a/Plugins/PluginNowPlaying/PlayerCAD.cpp +++ b/Plugins/PluginNowPlaying/PlayerCAD.cpp @@ -138,22 +138,16 @@ void CPlayerCAD::Initialize() LPCTSTR classSz = className.empty() ? NULL : className.c_str(); LPCTSTR windowSz = windowName.empty() ? NULL : windowName.c_str(); - if (windowName == L"VLC") - { - // Temporary workaround - m_ExtendedAPI = true; - } - if (classSz || windowSz) { m_PlayerWindow = FindWindow(classSz, windowSz); } else { - m_PlayerWindow = FindWindow(L"CD Art Display IPC Class", NULL); + classSz = L"CD Art Display IPC Class"; + m_PlayerWindow = FindWindow(classSz, NULL); if (m_PlayerWindow) { - classSz = L"CD Art Display IPC Class"; WritePrivateProfileString(L"NowPlaying.dll", L"ClassName", classSz, file); windowSz = (GetWindowText(m_PlayerWindow, buffer, MAX_PATH) > 0) ? buffer : NULL; @@ -177,6 +171,12 @@ void CPlayerCAD::Initialize() if (m_PlayerWindow) { m_Initialized = true; + + if (classSz && wcscmp(classSz, L"CD Art Display IPC Class") == 0) + { + m_ExtendedAPI = true; + } + SendMessage(m_PlayerWindow, WM_USER, (WPARAM)m_Window, IPC_SET_CALLBACK_HWND); m_State = (PLAYSTATE)SendMessage(m_PlayerWindow, WM_USER, 0, IPC_GET_STATE); @@ -347,7 +347,7 @@ LRESULT CALLBACK CPlayerCAD::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (player->m_PlayerWindow) { player->m_Initialized = true; - player->m_ExtendedAPI = (windowName == L"VLC"); + player->m_ExtendedAPI = (classSz && wcscmp(classSz, L"CD Art Display IPC Class") == 0); player->m_State = (PLAYSTATE)SendMessage(player->m_PlayerWindow, WM_USER, 0, IPC_GET_STATE); if (player->m_State != PLAYER_STOPPED)