From 09b6d7659859e1622bdd55dc1cdc32ea809a9fa9 Mon Sep 17 00:00:00 2001 From: Dakoon Date: Fri, 7 Apr 2017 19:50:15 +0200 Subject: [PATCH] #2 - Added a menueitem to check if close to try is active. --- WhatsappTray/WhatsappTray.cpp | 7 ++++++- WhatsappTray/WhatsappTray.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/WhatsappTray/WhatsappTray.cpp b/WhatsappTray/WhatsappTray.cpp index 0c6990c..3c465ee 100644 --- a/WhatsappTray/WhatsappTray.cpp +++ b/WhatsappTray/WhatsappTray.cpp @@ -30,6 +30,7 @@ static HMODULE _hLib; static HWND _hwndHook; static HWND _hwndItems[MAXTRAYITEMS]; static HWND _hwndForMenu; +static bool closeToTray; int FindInTray(HWND hwnd) { for (int i = 0; i < MAXTRAYITEMS; i++) { @@ -152,6 +153,10 @@ void ExecuteMenu() { MessageBox(NULL, L"Error creating menu.", L"WhatsappTray", MB_OK | MB_ICONERROR); return; } + if (closeToTray) + { + AppendMenu(hMenu, MF_STRING, IDM_DUMMY, L"Close to tray active."); + } AppendMenu(hMenu, MF_STRING, IDM_ABOUT, L"About WhatsappTray"); AppendMenu(hMenu, MF_STRING, IDM_EXIT, L"Exit WhatsappTray"); AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); //-------------- @@ -253,7 +258,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine WNDCLASS wc; MSG msg; - bool closeToTray = strstr(szCmdLine, "--closeToTray"); + closeToTray = strstr(szCmdLine, "--closeToTray"); _hInstance = hInstance; _hwndHook = FindWindow(NAME, NAME); diff --git a/WhatsappTray/WhatsappTray.h b/WhatsappTray/WhatsappTray.h index d5a4ddd..14fd72c 100644 --- a/WhatsappTray/WhatsappTray.h +++ b/WhatsappTray/WhatsappTray.h @@ -9,6 +9,7 @@ #define IDM_CLOSE 0x1002 #define IDM_EXIT 0x1003 #define IDM_ABOUT 0x1004 +#define IDM_DUMMY 0x0405 #define DLLIMPORT __declspec(dllexport)