diff --git a/RBTray.cpp b/RBTray.cpp index bc2483d..2ac0d17 100644 --- a/RBTray.cpp +++ b/RBTray.cpp @@ -322,6 +322,7 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE /*hPrevInstance* LPWSTR * argv = CommandLineToArgvW(GetCommandLineW(), &argc); bool shouldExit = false; bool useHook = true; + bool useHotKey = true; for (int a = 0; a < argc; ++a) { if (!wcscmp(argv[a], L"--exit")) { shouldExit = true; @@ -329,6 +330,9 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE /*hPrevInstance* if (!wcscmp(argv[a], L"--no-hook")) { useHook = false; } + if (!wcscmp(argv[a], L"--no-hotkey")) { + useHotKey = false; + } } _hwndHook = FindWindow(NAME, NAME); @@ -379,9 +383,14 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE /*hPrevInstance* WM_TASKBAR_CREATED = RegisterWindowMessage(L"TaskbarCreated"); - BOOL registeredHotKey = RegisterHotKey(_hwndHook, 0, MOD_ALT | MOD_CONTROL, VK_DOWN); - if (!registeredHotKey) { - MessageBox(NULL, L"Couldn't register hotkey", L"RBTray", MB_OK | MB_ICONERROR); + BOOL registeredHotKey = false; + + if (useHotKey) { + registeredHotKey = RegisterHotKey(_hwndHook, 0, MOD_ALT | MOD_CONTROL, VK_DOWN); + + if (!registeredHotKey) { + MessageBox(NULL, L"Couldn't register hotkey", L"RBTray", MB_OK | MB_ICONERROR); + } } MSG msg;