Sorry for the late reply, I saw this earlier but I was busy.
Anyways, here's a little example.
[php]#include <windows.h>
#include <iostream>
using namespace std;
LRESULT CALLBACK KeyboardHook(int Code,WPARAM wParam, LPARAM lParam)
{
PKBDLLHOOKSTRUCT Hook = (PKBDLLHOOKSTRUCT)lParam;
if(wParam == WM_KEYDOWN)
{
if(Hook->vkCode == 'A')
{
cout<< "You pressed A";
}
}
return CallNextHookEx(0,Code,wParam,lParam);
}
int main()
{
MSG msg;
HINSTANCE hInstance = GetModuleHandle(NULL);
SetWindowsHookEx(WH_KEYBOARD_LL,KeyboardHook,hInst ance,0);
GetMessage(&msg,0,0,0);
}
[/php]
I'm pretty sure you know what to do from here.
I won't take any credit for this, B1ackAnge1 posted something on this a while ago.