NowPlayingPlugin: Minor changes.

This commit is contained in:
Birunthan Mohanathas 2011-07-15 15:18:02 +00:00
parent 5e20238120
commit 20e2a53324
5 changed files with 18 additions and 20 deletions

View File

@ -32,6 +32,7 @@
static std::map<UINT, ChildMeasure*> g_Measures;
std::wstring g_CachePath;
std::wstring g_SettingsFile;
HINSTANCE g_Instance = NULL;
/*
** Initialize
@ -63,6 +64,7 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
LSLog(LOG_ERROR, L"Rainmeter", L"NowPlayingPlugin: Unable to get path to Plugins.ini.");
}
g_Instance = instance;
CInternet::Initialize();
}

View File

@ -22,6 +22,7 @@
CPlayer* CPlayerCAD::c_Player = NULL;
extern std::wstring g_SettingsFile;
extern HINSTANCE g_Instance;
// This player emulates the CD Art Display IPC interface, which is supported by
// MusicBee, VLC (with libcad plugin), and possibly others.
@ -76,11 +77,9 @@ CPlayer* CPlayerCAD::Create()
*/
void CPlayerCAD::Initialize()
{
HINSTANCE hInstance = GetModuleHandle(NULL);
// Create windows class
WNDCLASS wc = {0};
wc.hInstance = hInstance;
wc.hInstance = g_Instance;
wc.lpfnWndProc = WndProc;
wc.lpszClassName = L"NowPlayingCADClass";
RegisterClass(&wc);
@ -95,7 +94,7 @@ void CPlayerCAD::Initialize()
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
g_Instance,
this);
// Add WM_USER/WM_COPYDATA to allowed messages from lower level processes
@ -197,7 +196,7 @@ void CPlayerCAD::Initialize()
void CPlayerCAD::Uninitialize()
{
DestroyWindow(m_Window);
UnregisterClass(L"NowPlayingCADClass", GetModuleHandle(NULL));
UnregisterClass(L"NowPlayingCADClass", g_Instance);
}
/*

View File

@ -20,6 +20,7 @@
#include "PlayerFoobar.h"
CPlayer* CPlayerFoobar::c_Player = NULL;
extern HINSTANCE g_Instance;
/*
** CPlayerFoobar
@ -70,11 +71,9 @@ CPlayer* CPlayerFoobar::Create()
*/
void CPlayerFoobar::Initialize()
{
HINSTANCE hInstance = GetModuleHandle(NULL);
// Create windows class
WNDCLASS wc = {0};
wc.hInstance = hInstance;
wc.hInstance = g_Instance;
wc.lpfnWndProc = WndProc;
wc.lpszClassName = L"NowPlayingFoobarClass";
RegisterClass(&wc);
@ -89,7 +88,7 @@ void CPlayerFoobar::Initialize()
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
g_Instance,
this);
m_FooWindow = FindWindow(L"foo_rainmeter_class", NULL);
@ -125,7 +124,7 @@ void CPlayerFoobar::Uninitialize()
}
DestroyWindow(m_Window);
UnregisterClass(L"NowPlayingFoobarClass", GetModuleHandle(NULL));
UnregisterClass(L"NowPlayingFoobarClass", g_Instance);
}
/*

View File

@ -20,6 +20,7 @@
#include "PlayerWLM.h"
CPlayer* CPlayerWLM::c_Player = NULL;
extern HINSTANCE g_Instance;
// This player emulates the MSN/WLM Messenger 'Listening to' interface, which is
// supported by OpenPandora, Last.fm, Media Player Classic, TTPlayer, Zune, etc.
@ -33,11 +34,9 @@ CPlayer* CPlayerWLM::c_Player = NULL;
CPlayerWLM::CPlayerWLM() : CPlayer(),
m_Window()
{
HINSTANCE hInstance = GetModuleHandle(NULL);
// Create windows class
WNDCLASS wc = {0};
wc.hInstance = hInstance;
wc.hInstance = g_Instance;
wc.lpfnWndProc = WndProc;
wc.lpszClassName = L"MsnMsgrUIManager";
RegisterClass(&wc);
@ -52,7 +51,7 @@ CPlayerWLM::CPlayerWLM() : CPlayer(),
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
g_Instance,
this);
m_Initialized = true;
@ -68,7 +67,7 @@ CPlayerWLM::~CPlayerWLM()
{
c_Player = NULL;
DestroyWindow(m_Window);
UnregisterClass(L"MsnMsgrUIManager", GetModuleHandle(NULL));
UnregisterClass(L"MsnMsgrUIManager", g_Instance);
}
/*

View File

@ -20,6 +20,7 @@
#include "PlayerWMP.h"
CPlayer* CPlayerWMP::c_Player = NULL;
extern HINSTANCE g_Instance;
/*
** CRemoteHost
@ -199,11 +200,9 @@ CPlayer* CPlayerWMP::Create()
*/
void CPlayerWMP::Initialize()
{
HINSTANCE hInstance = GetModuleHandle(NULL);
// Create windows class
WNDCLASS wc = {0};
wc.hInstance = hInstance;
wc.hInstance = g_Instance;
wc.lpfnWndProc = DefWindowProc;
wc.lpszClassName = L"NowPlayingWMPClass";
RegisterClass(&wc);
@ -218,7 +217,7 @@ void CPlayerWMP::Initialize()
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
g_Instance,
NULL);
if (!m_Window)
@ -366,7 +365,7 @@ void CPlayerWMP::Uninitialize()
m_AxWindow->DestroyWindow();
delete m_AxWindow;
DestroyWindow(m_Window);
UnregisterClass(L"NowPlayingWMPClass", GetModuleHandle(NULL));
UnregisterClass(L"NowPlayingWMPClass", g_Instance);
}
}