private static HookProc KeyboardProc;
public InterceptKeys(String holder)
{
Hook();
}
public void Hook()
{
IntPtr hInstance = LoadLibrary("User32");
KeyboardProc = HookCallback;
_hookID = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardProc, hInstance, 0);
if (_hookID == (IntPtr) 0)
{
Console.WriteLine("Failed to hook.");
}
Console.WriteLine("[Success!] _hookID: "+_hookID);
}
This is the new code, hopefully I did what you asked. Still isn't working though. The hookID is working and everything, but still no keys being caught. I also tried
KeyboardProc = new HookProc(HookCallback);
That didn't work either.