From 36aa2485564678ba23c871e9666719cc169c62cf Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 26 Jul 2016 11:52:44 -0400 Subject: [PATCH] Graceful shutdown --- Win32/Win32App.cpp | 8 ++++++++ Win32/Win32App.h | 1 + 2 files changed, 9 insertions(+) diff --git a/Win32/Win32App.cpp b/Win32/Win32App.cpp index cd9837ba..7da8f882 100644 --- a/Win32/Win32App.cpp +++ b/Win32/Win32App.cpp @@ -239,5 +239,13 @@ namespace win32 { UnregisterClass (I2PD_WIN32_CLASSNAME, GetModuleHandle(NULL)); } + + bool GracefulShutdown () + { + HWND hWnd = FindWindow (I2PD_WIN32_CLASSNAME, TEXT("i2pd")); + if (hWnd) + PostMessage (hWnd, WM_COMMAND, MAKEWPARAM(ID_GRACEFUL_SHUTDOWN, 0), 0); + return hWnd; + } } } diff --git a/Win32/Win32App.h b/Win32/Win32App.h index 7d35ec1e..3babffa9 100644 --- a/Win32/Win32App.h +++ b/Win32/Win32App.h @@ -10,6 +10,7 @@ namespace win32 bool StartWin32App (); void StopWin32App (); int RunWin32App (); + bool GracefulShutdown (); } } #endif // WIN32APP_H__