Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZeroitTextKeyboard" /> class.
 /// </summary>
 public ZeroitTextKeyboard()
 {
     if (kf == null)
     {
         kf = new KeyboardFilter();
         Application.AddMessageFilter(kf);
     }
     kf.MouseDown += kf_MouseDown;
 }
        public static void Send(int VKey, KeyboardEvent e = KeyboardEvent.Both)
        {
            uint extended_flag = (VKey >= 16 && VKey <= 18) || (VKey >= 160 && VKey <= 165) ? 0 : KEYEVENTF_EXTENDEDKEY;
            Key  key           = (Key)System.Windows.Input.KeyInterop.KeyFromVirtualKey(VKey);

            if (e.HasFlag(KeyboardEvent.Down))
            {
                keybd_event((byte)VKey, 0, extended_flag, 0);
                KeyboardFilter.Expect(key, true);
            }
            if (e.HasFlag(KeyboardEvent.Up))
            {
                keybd_event((byte)VKey, 0, extended_flag | KEYEVENTF_KEYUP, 0);
                KeyboardFilter.Expect(key, false);
            }
        }
Exemple #3
0
        public static void Send(int vKey, KeyboardEvent e = KeyboardEvent.Both)
        {
            var extendedFlag = (vKey >= 16 && vKey <= 18) || (vKey >= 160 && vKey <= 165) ? 0 : KEYEVENTF_EXTENDEDKEY;
            var key          = KeyInterop.KeyFromVirtualKey(vKey);

            if (e.HasFlag(KeyboardEvent.Down))
            {
                keybd_event((byte)vKey, 0, extendedFlag, 0);
                KeyboardFilter.Expect(key, true);
            }

            if (e.HasFlag(KeyboardEvent.Up))
            {
                keybd_event((byte)vKey, 0, extendedFlag | KEYEVENTF_KEYUP, 0);
                KeyboardFilter.Expect(key, false);
            }
        }
Exemple #4
0
 public static void SetFilter(Context context, Predicate interception_predicate, KeyboardFilter filter) => DllWrapper.SetFilter(context, interception_predicate, (Filter)filter);
 public KeyboardHook(KeyboardFilter filter = KeyboardFilter.All, CallbackAction callback = null) :
     base((Filter)filter, InputInterceptor.IsKeyboard, callback)
 {
 }