In my keyboard hook, each keypress gets a flag that states if it was injected or not. http://msdn.microsoft.com/en-us/library/ms644967(VS.85).aspx
I've distilled a KBDLLHOOKSTRUCT from the lParam. I can access kbd.flags.XXX. I just don't know how to convert this 8bit flag into an if (injected) {...
type conditional that I know how to use.
If one of you smart computer-science types would help me out I'd really appreciate it.
private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
{
KBDLLHOOKSTRUCT kbd = new KBDLLHOOKSTRUCT();
Marshal.PtrToStructure(lParam, kbd);
//if (injected) {...
Cheers!
A first chance exception of type 'System.ArgumentException' occurred in foofoo.exe
Seems to be messing up the previous keyboard hook code I had as well. What gives? It's also not compiling unless I add parentheses:bool isInjected = ((kbd.flags & LLKHF_INJECTED) != 0);
... is that changing the code? – Discovery