Exemplo n.º 1
0
        public static HotKeyManager hkm = new HotKeyManager();//modified only by Main Thread

        public KeyboardListener(GlobalHooker hooker, HotKeySuite HKCollection, bool blockLocalInput = false, bool blockRemoteInput = true)
        {
            if (hooker == null)
            {
                throw new ArgumentNullException("invalid keyboard hooker");
            }

            h = hooker;
            //hkc = HKCollection;
            //hkm=new HotKeyManager();
            Hotkeys.HotKeyHelper.fullfillHotKeys();
            KeyboardListener.blockLocalInput  = blockLocalInput;
            KeyboardListener.blockRemoteInput = blockRemoteInput;

            HookCallbackReference = new HookCallback(HookCallback);
            try
            {
                HookHandle = h.Subscribe(GetHookId(), HookCallbackReference);
            }
            catch (Exception)
            {
                HookCallbackReference = null;
                HookHandle            = IntPtr.Zero;
                throw;
            }
        }
        public MouseListener(GlobalHooker hooker, bool blockLocalInput = false, bool blockRemoteInput = true)
        {
            if (hooker == null)
            {
                throw new ArgumentNullException("invalid mouse hooker");
            }
            h = hooker;
            MouseListener.blockLocalInput  = blockLocalInput;
            MouseListener.blockRemoteInput = blockRemoteInput;

            HookCallbackReference = new HookCallback(HookCallback);
            try
            {
                HookHandle = h.Subscribe(GetHookId(), HookCallbackReference);
            }
            catch (Exception)
            {
                HookCallbackReference = null;
                HookHandle            = IntPtr.Zero;
                throw;
            }
            mouseTypeMovement = Form1.getForm().mouseTypeMovement;
            System.Drawing.Rectangle rect = Form1.getForm().getScreenSize();
            _screenSize.x = rect.Width;
            _screenSize.y = rect.Height;
        }