NowPlayingPlugin: Fixed PlayPause issue with MusicBee.

This commit is contained in:
Birunthan Mohanathas 2011-07-10 09:30:51 +00:00
parent 349ad952ad
commit a74ee23da3
5 changed files with 16 additions and 14 deletions

View File

@ -154,12 +154,6 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
}
else
{
if (_wcsicmp(L"MusicBee", str) == 0)
{
// TODO: Remove this in a few weeks (left here for MusicBee backwards compatibility)
MessageBox(NULL, L"Due to some internal changes in the NowPlaying plugin, PlayerName=MusicBee is not valid any longer.\n\nPlease edit the skin and change to PlayerName=CAD to continue use with MusicBee.", L"NowPlaying", MB_OK | MB_ICONINFORMATION | MB_TOPMOST);
}
std::wstring error = L"NowPlayingPlugin: PlayerName=";
error += str;
error += L" in section [";
@ -301,7 +295,6 @@ void Finalize(HMODULE instance, UINT id)
}
/*
** Update
**
** Called on each update.

View File

@ -76,12 +76,12 @@ void CPlayer::AddInstance()
*/
void CPlayer::RemoveInstance()
{
m_UpdateCount = 0;
if (--m_InstanceCount == 0)
{
delete this;
}
m_UpdateCount = 0;
}
/*

View File

@ -34,7 +34,8 @@ extern std::wstring g_SettingsFile;
*/
CPlayerCAD::CPlayerCAD() : CPlayer(),
m_Window(),
m_PlayerWindow()
m_PlayerWindow(),
m_ExtendedAPI(false)
{
Initialize();
}
@ -138,6 +139,12 @@ 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);
@ -339,6 +346,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_State = (PLAYSTATE)SendMessage(player->m_PlayerWindow, WM_USER, 0, IPC_GET_STATE);
if (player->m_State != PLAYER_STOPPED)
@ -379,7 +387,7 @@ void CPlayerCAD::UpdateData()
*/
void CPlayerCAD::Pause()
{
SendMessage(m_PlayerWindow, WM_USER, 0, IPC_PAUSE);
SendMessage(m_PlayerWindow, WM_USER, 0, m_ExtendedAPI ? IPC_PAUSE : IPC_PLAYPAUSE);
}
/*
@ -390,7 +398,7 @@ void CPlayerCAD::Pause()
*/
void CPlayerCAD::Play()
{
SendMessage(m_PlayerWindow, WM_USER, 0, IPC_PLAY);
SendMessage(m_PlayerWindow, WM_USER, 0, m_ExtendedAPI ? IPC_PLAY : IPC_PLAYPAUSE);
}
/*

View File

@ -57,6 +57,7 @@ private:
HWND m_Window;
HWND m_PlayerWindow;
std::wstring m_PlayerPath;
bool m_ExtendedAPI;
};
#endif

View File

@ -18,9 +18,9 @@ VS_VERSION_INFO VERSIONINFO
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT_UNKNOWN
BEGIN