NowPlayingPlugin: Minor changes.

This commit is contained in:
Birunthan Mohanathas 2011-08-21 13:24:24 +00:00
parent 2c7c53553b
commit 6debf4b780
2 changed files with 13 additions and 13 deletions

View File

@ -273,7 +273,7 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
*/ */
void Finalize(HMODULE instance, UINT id) void Finalize(HMODULE instance, UINT id)
{ {
std::map<UINT, ChildMeasure*>::iterator i = g_Measures.find(id); std::map<UINT, ChildMeasure*>::const_iterator i = g_Measures.find(id);
if (i != g_Measures.end()) if (i != g_Measures.end())
{ {
ChildMeasure* child = (*i).second; ChildMeasure* child = (*i).second;
@ -304,7 +304,7 @@ void Finalize(HMODULE instance, UINT id)
*/ */
UINT Update(UINT id) UINT Update(UINT id)
{ {
std::map<UINT, ChildMeasure*>::iterator i = g_Measures.find(id); std::map<UINT, ChildMeasure*>::const_iterator i = g_Measures.find(id);
if (i != g_Measures.end()) if (i != g_Measures.end())
{ {
ChildMeasure* child = (*i).second; ChildMeasure* child = (*i).second;
@ -367,7 +367,7 @@ UINT Update(UINT id)
*/ */
LPCTSTR GetString(UINT id, UINT flags) LPCTSTR GetString(UINT id, UINT flags)
{ {
std::map<UINT, ChildMeasure*>::iterator i = g_Measures.find(id); std::map<UINT, ChildMeasure*>::const_iterator i = g_Measures.find(id);
if (i != g_Measures.end()) if (i != g_Measures.end())
{ {
ChildMeasure* child = (*i).second; ChildMeasure* child = (*i).second;
@ -440,7 +440,7 @@ LPCTSTR GetString(UINT id, UINT flags)
*/ */
void ExecuteBang(LPCTSTR bang, UINT id) void ExecuteBang(LPCTSTR bang, UINT id)
{ {
std::map<UINT, ChildMeasure*>::iterator i = g_Measures.find(id); std::map<UINT, ChildMeasure*>::const_iterator i = g_Measures.find(id);
if (i != g_Measures.end()) if (i != g_Measures.end())
{ {
ChildMeasure* child = (*i).second; ChildMeasure* child = (*i).second;

View File

@ -138,22 +138,16 @@ void CPlayerCAD::Initialize()
LPCTSTR classSz = className.empty() ? NULL : className.c_str(); LPCTSTR classSz = className.empty() ? NULL : className.c_str();
LPCTSTR windowSz = windowName.empty() ? NULL : windowName.c_str(); LPCTSTR windowSz = windowName.empty() ? NULL : windowName.c_str();
if (windowName == L"VLC")
{
// Temporary workaround
m_ExtendedAPI = true;
}
if (classSz || windowSz) if (classSz || windowSz)
{ {
m_PlayerWindow = FindWindow(classSz, windowSz); m_PlayerWindow = FindWindow(classSz, windowSz);
} }
else 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) if (m_PlayerWindow)
{ {
classSz = L"CD Art Display IPC Class";
WritePrivateProfileString(L"NowPlaying.dll", L"ClassName", classSz, file); WritePrivateProfileString(L"NowPlaying.dll", L"ClassName", classSz, file);
windowSz = (GetWindowText(m_PlayerWindow, buffer, MAX_PATH) > 0) ? buffer : NULL; windowSz = (GetWindowText(m_PlayerWindow, buffer, MAX_PATH) > 0) ? buffer : NULL;
@ -177,6 +171,12 @@ void CPlayerCAD::Initialize()
if (m_PlayerWindow) if (m_PlayerWindow)
{ {
m_Initialized = true; 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); SendMessage(m_PlayerWindow, WM_USER, (WPARAM)m_Window, IPC_SET_CALLBACK_HWND);
m_State = (PLAYSTATE)SendMessage(m_PlayerWindow, WM_USER, 0, IPC_GET_STATE); 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) if (player->m_PlayerWindow)
{ {
player->m_Initialized = true; 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); player->m_State = (PLAYSTATE)SendMessage(player->m_PlayerWindow, WM_USER, 0, IPC_GET_STATE);
if (player->m_State != PLAYER_STOPPED) if (player->m_State != PLAYER_STOPPED)