LowLevelKeyboardProc hook not triggered for brightness keys

Viewed 142

I'm trying to intercept keyboard events using win32 API in C++. My problem is that some special keys (for brightness) do not trigger my callback.

I have a Dell XPS 15, last model. It has some media keys at the top to adjust audio settings and screen brightness. I can see the audio settings keys being pressed using a WH_KEYBOARD_LL hook, but not the screen brightness keys.

I want to intercept and remap the screen brightness keys. What am I missing?

Here's how I register the callback:

HHOOK keyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, keyboardHookProc, 0, 0);

And here's my callback:

LRESULT CALLBACK keyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam) {
    PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT)(lParam);
    std::cout << p->vkCode << endl;
    return CallNextHookEx(NULL, nCode, wParam, lParam);
}
0 Answers
Related