mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Now re-registers Rainmeter icon when Explorer was restarted.
This commit is contained in:
parent
5246ca94c6
commit
2a030c084c
@ -34,6 +34,8 @@
|
|||||||
#define RAINMETER_MANUALBETA L"http://rainmeter.net/RainCMS/?q=ManualBeta"
|
#define RAINMETER_MANUALBETA L"http://rainmeter.net/RainCMS/?q=ManualBeta"
|
||||||
#define RAINMETER_DOWNLOADS L"http://rainmeter.net/RainCMS/?q=Downloads"
|
#define RAINMETER_DOWNLOADS L"http://rainmeter.net/RainCMS/?q=Downloads"
|
||||||
|
|
||||||
|
const UINT WM_TASKBARCREATED = ::RegisterWindowMessage(L"TaskbarCreated");
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern CRainmeter* Rainmeter;
|
||||||
|
|
||||||
using namespace Gdiplus;
|
using namespace Gdiplus;
|
||||||
@ -46,7 +48,8 @@ CTrayWindow::CTrayWindow(HINSTANCE instance) : m_Instance(instance),
|
|||||||
m_TrayColor2(0, 255, 0),
|
m_TrayColor2(0, 255, 0),
|
||||||
m_Bitmap(),
|
m_Bitmap(),
|
||||||
m_TrayValues(),
|
m_TrayValues(),
|
||||||
m_TrayPos()
|
m_TrayPos(),
|
||||||
|
m_TrayIconEnabled(true)
|
||||||
{
|
{
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
|
|
||||||
@ -365,8 +368,8 @@ void CTrayWindow::ReadConfig(CConfigParser& parser)
|
|||||||
LogWithArgs(LOG_ERROR, L"No such TrayMeter: %s", type.c_str());
|
LogWithArgs(LOG_ERROR, L"No such TrayMeter: %s", type.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
int trayIcon = parser.ReadInt(L"Rainmeter", L"TrayIcon", 1);
|
m_TrayIconEnabled = 0!=parser.ReadInt(L"Rainmeter", L"TrayIcon", 1);
|
||||||
if (trayIcon != 0)
|
if (m_TrayIconEnabled)
|
||||||
{
|
{
|
||||||
AddTrayIcon();
|
AddTrayIcon();
|
||||||
|
|
||||||
@ -375,6 +378,10 @@ void CTrayWindow::ReadConfig(CConfigParser& parser)
|
|||||||
SetTimer(m_Window, TRAYTIMER, 1000, NULL); // Update the tray once per sec
|
SetTimer(m_Window, TRAYTIMER, 1000, NULL); // Update the tray once per sec
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RemoveTrayIcon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -386,6 +393,14 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
{
|
{
|
||||||
tray=(CTrayWindow*)((LPCREATESTRUCT)lParam)->lpCreateParams;
|
tray=(CTrayWindow*)((LPCREATESTRUCT)lParam)->lpCreateParams;
|
||||||
}
|
}
|
||||||
|
else if (uMsg == WM_TASKBARCREATED)
|
||||||
|
{
|
||||||
|
if (tray && tray->IsTrayIconEnabled())
|
||||||
|
{
|
||||||
|
tray->RemoveTrayIcon();
|
||||||
|
tray->AddTrayIcon();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
{
|
{
|
||||||
|
@ -47,6 +47,7 @@ public:
|
|||||||
|
|
||||||
void ReadConfig(CConfigParser& parser);
|
void ReadConfig(CConfigParser& parser);
|
||||||
HWND GetWindow() { return m_Window; }
|
HWND GetWindow() { return m_Window; }
|
||||||
|
bool IsTrayIconEnabled() { return m_TrayIconEnabled; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
@ -71,6 +72,8 @@ private:
|
|||||||
|
|
||||||
double m_TrayValues[TRAYICON_SIZE];
|
double m_TrayValues[TRAYICON_SIZE];
|
||||||
int m_TrayPos;
|
int m_TrayPos;
|
||||||
|
|
||||||
|
bool m_TrayIconEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user