History: Keyboard hit ID
View: 
1575
x  Likes: 
1
Get keyboard hit ID
Hooking of keyboard hit ID. No need to have an active console window - can be used for hidden features.
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h> #include <tchar.h> #include <windows.h> #include <iostream> using namespace std; HHOOK hHook; LRESULT CALLBACK KeyboardProc(int nCode,WPARAM wParam, LPARAM lParam) { if(wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN) { PKBDLLHOOKSTRUCT pKey = (PKBDLLHOOKSTRUCT)lParam; cout << pKey->vkCode << " "; if(pKey->vkCode == VK_PRIOR) cout << endl << "Page Up!" << endl; } CallNextHookEx(hHook,nCode,wParam,lParam); return 0; } int _tmain(int argc, _TCHAR* argv[]) { HMODULE hInstance = GetModuleHandle(NULL); hHook = SetWindowsHookEx(WH_KEYBOARD_LL,KeyboardProc,hInstance,NULL); MSG msg; GetMessage(&msg,NULL,NULL,NULL); UnhookWindowsHookEx(hHook); return 0; }
Code.Tode.cz by Henry - 2014