History: Keyboard hit ID
Get keyboard hit ID
Hooking of keyboard hit ID. No need to have an active console window - can be used for hidden features.
Code
#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
Získejte registraci domén s tld .online, .space, .store, .tech zdarma!
Stačí si k jedné z těchto domén vybrat hosting Plus nebo Mega a registraci domény od nás dostanete za 0 Kč!
Objednat