private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0 && (wParam == (IntPtr)WM_KEYDOWN) | (wParam == (IntPtr)WM_KEYUP)) { int vkCode = Marshal.ReadInt32(lParam); if (specialkey.HasFlag((SpecialKey)vkCode)) { checkspecialkey = true; special = (SpecialKey)vkCode; } else if (fnumberkey.HasFlag((FnumberKey)vkCode)) { checkfnumberkey = true; fnumber = (FnumberKey)vkCode; } if (checkspecialkey && checkfnumberkey) { input = special.ToString() + "+" + fnumber.ToString(); checkspecialkey = false; checkfnumberkey = false; } } return(CallNextHookEx(_hookID, nCode, wParam, lParam)); }