diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index eba95ddb..44db887d 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -668,6 +668,11 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg) } } break; + + case BANG_QUIT: + if (Rainmeter->GetDummyLitestep()) PostQuitMessage(0); + quitModule(Rainmeter->GetInstance()); + break; } } diff --git a/Library/MeterWindow.h b/Library/MeterWindow.h index 9dfbbe97..540b991b 100644 --- a/Library/MeterWindow.h +++ b/Library/MeterWindow.h @@ -96,7 +96,8 @@ enum BANGCOMMAND BANG_LSHOOK, BANG_ABOUT, BANG_MOVEMETER, - BANG_PLUGIN + BANG_PLUGIN, + BANG_QUIT }; typedef struct diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index dc33d6c7..9ab5f6ca 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -569,6 +569,17 @@ void RainmeterPluginBang(HWND, const char* arg) BangWithArgs(BANG_PLUGIN, ConvertToWide(arg).c_str(), 1); } +/* +** RainmeterQuit +** +** Callback for the !RainmeterQuit bang +** +*/ +void RainmeterQuit(HWND, const char* arg) +{ + BangWithArgs(BANG_QUIT, ConvertToWide(arg).c_str(), 0); +} + // ----------------------------------------------------------------------------------------------- // // The class starts here @@ -879,6 +890,7 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath) AddBangCommand("!RainmeterResetStats", RainmeterResetStats); AddBangCommand("!RainmeterMoveMeter", RainmeterMoveMeter); AddBangCommand("!RainmeterPluginBang", RainmeterPluginBang); + AddBangCommand("!RainmeterQuit", RainmeterQuit); } // Create meter windows for active configs @@ -1135,6 +1147,7 @@ void CRainmeter::Quit(HINSTANCE dllInst) RemoveBangCommand("!RainmeterResetStats"); RemoveBangCommand("!RainmeterMoveMeter"); RemoveBangCommand("!RainmeterPluginBang"); + RemoveBangCommand("!RainmeterQuit"); } } @@ -1289,7 +1302,7 @@ BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg, { BangWithArgs(BANG_MOVE, arg.c_str(), 2); } - else if (wcsicmp(bang.c_str(), L"!RainmeterChangeZPos") == 0) // For backwards combatibility + else if (wcsicmp(bang.c_str(), L"!RainmeterChangeZPos") == 0) // For backwards compatibility { BangWithArgs(BANG_ZPOS, arg.c_str(), 1); } @@ -1317,6 +1330,10 @@ BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg, { // Nothing to do here (this works only with Litestep) } + else if (wcsicmp(bang.c_str(), L"!RainmeterQuit") == 0) + { + BangWithArgs(BANG_QUIT, arg.c_str(), 0); + } else if (wcsicmp(bang.c_str(), L"!Execute") == 0) { // Special case for multibang execution diff --git a/Library/Rainmeter.h b/Library/Rainmeter.h index 625c2413..e1e48513 100644 --- a/Library/Rainmeter.h +++ b/Library/Rainmeter.h @@ -69,6 +69,7 @@ void RainmeterAbout(HWND, const char* arg); void RainmeterResetStats(HWND, const char* arg); void RainmeterMoveMeter(HWND, const char* arg); void RainmeterPluginBang(HWND, const char* arg); +void RainmeterQuit(HWND, const char* arg); void BangWithArgs(BANGCOMMAND bang, const WCHAR* arg, size_t numOfArgs);