资源简介

免资源分提供下载,这是一个C#编写的全局键盘监听的类。 可以参考:http://www.wxzzz.com/?id=172 其中包括了键盘按键的全局监听,鼠标的监听。封装的非常好,使用起来非常方便。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Windows.Forms;

namespace AdrHook
{
    /// 
    /// 功能说明:该组件监视所有的鼠标活动在全局范围(同时也是应用程序之外)
    /// 开发人员:王旭(http://www.wxzzz.com)
    /// 开发时间:2014年4月3日
    /// 

    public class GlobalEventProvider : Component
    {
        /// 
        /// 该组件引发事件。该值始终为true
        /// 

        protected override bool CanRaiseEvents
        {
            get
            {
                return true;
            }
        }

        #region 鼠标事件

        private event MouseEventHandler m_MouseMove;

        /// 
        /// 当鼠标指针移动时发生
        /// 

        public event MouseEventHandler MouseMove
        {
            add
            {
                if (m_MouseMove == null)
                {
                    HookManager.MouseMove += HookManager_MouseMove;
                }
                m_MouseMove += value;
            }

            remove
            {
                m_MouseMove -= value;
                if (m_MouseMove == null)
                {
                    HookManager.MouseMove -= HookManager_MouseMove;
                }
            }
        }

        void HookManager_MouseMove(object sender MouseEventArgs e)
        {
            if (m_MouseMove != null)
            {
                m_MouseMove.Invoke(this e);
            }
        }

        private event MouseEventHandler m_MouseClick;
        /// 
        /// 当点击由鼠标完成时发生
        /// 

        public event MouseEventHandler MouseClick
        {
            add
            {
                if (m_MouseClick == null)
                {
                    HookManager.MouseClick += HookManager_MouseClick;
                }
                m_MouseClick += value;
            }

            remove
            {
                m_MouseClick -= value;
                if (m_MouseClick == null)
                {
                    HookManager.MouseClick -= HookManager_MouseClick;
                }
            }
        }

        void HookManager_MouseClick(object sender MouseEventArgs e)
        {
            if (m_MouseClick != null)
            {
                m_MouseClick.Invoke(this e);
            }
        }

        private event MouseEventHandler m_MouseDown;

        /// 
        /// 当鼠标按下鼠标按钮时发生
        /// 

        public event MouseEventHandler MouseDown
        {
            add
            {
                if (m_MouseDown == null)
                {
                    HookManager.MouseDown += HookManager_MouseDown;
                }
                m_MouseDown += value;
            }

            remove
            {
                m_MouseDown -= value;
                if (m_MouseDown == null)
                {
                    HookManager.MouseDown -= HookMana

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2631  2014-04-03 11:23  AdrHookDemo\AdrHook\AdrHook.csproj

     文件      19456  2014-04-03 12:45  AdrHookDemo\AdrHook\bin\Debug\AdrHook.dll

     文件      42496  2014-04-03 12:45  AdrHookDemo\AdrHook\bin\Debug\AdrHook.pdb

     文件       9960  2014-04-03 12:45  AdrHookDemo\AdrHook\GlobalEventProvider.cs

     文件      14120  2014-04-03 12:44  AdrHookDemo\AdrHook\HookManager.Callback.cs

     文件      10308  2014-04-03 11:40  AdrHookDemo\AdrHook\HookManager.cs

     文件       3038  2014-04-03 12:44  AdrHookDemo\AdrHook\HookManager.Structures.cs

     文件       5629  2014-04-03 12:44  AdrHookDemo\AdrHook\HookManager.Windows.cs

     文件       1264  2014-04-03 12:44  AdrHookDemo\AdrHook\MouseEventExtArgs.cs

     文件        623  2014-04-03 12:45  AdrHookDemo\AdrHook\obj\Debug\AdrHook.csproj.FileListAbsolute.txt

     文件      19456  2014-04-03 12:45  AdrHookDemo\AdrHook\obj\Debug\AdrHook.dll

     文件      42496  2014-04-03 12:45  AdrHookDemo\AdrHook\obj\Debug\AdrHook.pdb

     文件       5821  2014-04-03 12:35  AdrHookDemo\AdrHook\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       1338  2014-04-03 11:09  AdrHookDemo\AdrHook\Properties\AssemblyInfo.cs

     文件       3764  2014-04-03 12:39  AdrHookDemo\AdrHookDemo\AdrHookDemo.csproj

     文件      19456  2014-04-03 12:45  AdrHookDemo\AdrHookDemo\bin\Debug\AdrHook.dll

     文件      42496  2014-04-03 12:45  AdrHookDemo\AdrHookDemo\bin\Debug\AdrHook.pdb

     文件      14848  2014-04-03 12:45  AdrHookDemo\AdrHookDemo\bin\Debug\AdrHookDemo.exe

     文件      28160  2014-04-03 12:45  AdrHookDemo\AdrHookDemo\bin\Debug\AdrHookDemo.pdb

     文件      22704  2014-04-03 12:41  AdrHookDemo\AdrHookDemo\bin\Debug\AdrHookDemo.vshost.exe

     文件       5883  2014-04-03 12:45  AdrHookDemo\AdrHookDemo\FrmMain.cs

     文件      12775  2014-04-03 12:39  AdrHookDemo\AdrHookDemo\FrmMain.Designer.cs

     文件       5817  2014-04-03 12:39  AdrHookDemo\AdrHookDemo\FrmMain.resx

     文件        822  2014-04-03 12:45  AdrHookDemo\AdrHookDemo\obj\Debug\AdrHookDemo.csproj.FileListAbsolute.txt

     文件        849  2014-04-03 12:45  AdrHookDemo\AdrHookDemo\obj\Debug\AdrHookDemo.csproj.GenerateResource.Cache

     文件       5587  2014-04-03 12:45  AdrHookDemo\AdrHookDemo\obj\Debug\AdrHookDemo.csprojResolveAssemblyReference.cache

     文件      14848  2014-04-03 12:45  AdrHookDemo\AdrHookDemo\obj\Debug\AdrHookDemo.exe

     文件        180  2014-04-03 12:45  AdrHookDemo\AdrHookDemo\obj\Debug\AdrHookDemo.FrmMain.resources

     文件      28160  2014-04-03 12:45  AdrHookDemo\AdrHookDemo\obj\Debug\AdrHookDemo.pdb

     文件        180  2014-04-03 12:45  AdrHookDemo\AdrHookDemo\obj\Debug\AdrHookDemo.Properties.Resources.resources

............此处省略31个文件信息

评论

共有 条评论