Added OnWakeAction.

Executes when returning from sleep/hibernation.
This commit is contained in:
Brian Ferguson 2013-04-27 09:26:03 -06:00
parent d09c18a862
commit 497f6bbf54
2 changed files with 18 additions and 0 deletions

View File

@ -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
}

View File

@ -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;