Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions RBTray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,17 @@ 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;
}
if (!wcscmp(argv[a], L"--no-hook")) {
useHook = false;
}
if (!wcscmp(argv[a], L"--no-hotkey")) {
useHotKey = false;
}
}

_hwndHook = FindWindow(NAME, NAME);
Expand Down Expand Up @@ -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;
Expand Down