开发者

What key was pressed? Keyboard hooks

I'm using low level hooks, but I can't determine what key was pressed. Values are the same for every single key. Is here something I'm doing wrong?

Hook method

void hook() {

    /** this part is probably not important since I use global WH_KEYBOARD_LL, is that right? */
    HWND hwnd = FindWindow(NULL, "Vertices.exe");
    HINSTANCE instance = (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE);
    /** end part */

    SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, instance /** or NULL ? */, NULL);
}

Callback definition (I do have content in the app)

LRESULT CALLBACK LowLeve开发者_开发技巧lKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam);

Values given with any key pressed

nCode:0 | wParam:0x100 | lParam:0x18fe14

just the wParam changes to 0x101 on key up (0x100 on key down)


KBDLLHOOKSTRUCT *kbdStruct = (KBDLLHOOKSTRUCT*)lParam;

:)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜