diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index 2bb3fada..1d9f6f71 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -2042,6 +2042,7 @@ bool CMeterWindow::ReadSkin() m_OnFocusAction = m_Parser.ReadString(L"Rainmeter", L"OnFocusAction", L"", false); m_OnUnfocusAction = m_Parser.ReadString(L"Rainmeter", L"OnUnfocusAction", L"", false); m_OnUpdateAction = m_Parser.ReadString(L"Rainmeter", L"OnUpdateAction", L"", false); + m_OnWakeAction = m_Parser.ReadString(L"Rainmeter", L"OnWakeAction", L"", false); m_WindowUpdate = m_Parser.ReadInt(L"Rainmeter", L"Update", INTERVAL_METER); m_TransitionUpdate = m_Parser.ReadInt(L"Rainmeter", L"TransitionUpdate", INTERVAL_TRANSITION); @@ -4528,6 +4529,20 @@ LRESULT CMeterWindow::OnMove(UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; } +/* +** Performs an action when returning from sleep +** +*/ +LRESULT CMeterWindow::OnWake(UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + if (wParam == PBT_APMRESUMEAUTOMATIC && !m_OnWakeAction.empty()) + { + Rainmeter->ExecuteCommand(m_OnWakeAction.c_str(), this); + } + + return 0; +} + /* ** The main window procedure for the meter window. ** @@ -4588,6 +4603,7 @@ LRESULT CALLBACK CMeterWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR MESSAGE(OnDisplayChange, WM_DISPLAYCHANGE) MESSAGE(OnSetWindowFocus, WM_SETFOCUS) MESSAGE(OnSetWindowFocus, WM_KILLFOCUS) + MESSAGE(OnWake, WM_POWERBROADCAST) END_MESSAGEPROC } diff --git a/Library/MeterWindow.h b/Library/MeterWindow.h index 42d85983..93d2fd0b 100644 --- a/Library/MeterWindow.h +++ b/Library/MeterWindow.h @@ -295,6 +295,7 @@ protected: LRESULT OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT OnDisplayChange(UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT OnSetWindowFocus(UINT uMsg, WPARAM wParam, LPARAM lParam); + LRESULT OnWake(UINT uMsg, WPARAM wParam, LPARAM lParam); private: enum STATE @@ -385,6 +386,7 @@ private: std::wstring m_OnFocusAction; std::wstring m_OnUnfocusAction; std::wstring m_OnUpdateAction; + std::wstring m_OnWakeAction; std::wstring m_BackgroundName; RECT m_BackgroundMargins;