• 大小: 0.05M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-03-28
  • 语言: 其他
  • 标签: 其他  

资源简介


简洁高效,利用全局键盘钩子监听键盘输入,在钩子回调函数中利用时间差判断输入字符的连续性来区别扫描枪输入,相关文章在本人博客

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Diagnostics;
using Microsoft.Win32;

namespace KeyboardHookTest
{
    public partial class Form1 : Form
    {
        private KeyboardHookLib _keyboardHook = null;  
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender EventArgs e)
        {
            //安装勾子  
            _keyboardHook = new KeyboardHookLib();
            _keyboardHook.InstallHook(this.KeyPress);  
        }

        private void button2_Click(object sender EventArgs e)
        {
            //卸载钩子
            if (_keyboardHook != null) _keyboardHook.UninstallHook();  
        }

        /// 
        /// 刷枪输入判断函数
        /// 

        /// 

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

     文件      11776  2018-01-12 15:21  KeyboardHookTest\KeyboardHookTest\bin\Debug\KeyboardHookTest.exe

     文件      34304  2018-01-12 15:21  KeyboardHookTest\KeyboardHookTest\bin\Debug\KeyboardHookTest.pdb

     文件      24216  2018-01-12 15:22  KeyboardHookTest\KeyboardHookTest\bin\Debug\KeyboardHookTest.vshost.exe

     文件        490  2014-01-13 21:31  KeyboardHookTest\KeyboardHookTest\bin\Debug\KeyboardHookTest.vshost.exe.manifest

     文件       2665  2018-01-12 15:21  KeyboardHookTest\KeyboardHookTest\Form1.cs

     文件       3669  2018-01-12 11:10  KeyboardHookTest\KeyboardHookTest\Form1.Designer.cs

     文件       5817  2018-01-12 15:21  KeyboardHookTest\KeyboardHookTest\Form1.resx

     文件       4822  2018-01-12 14:43  KeyboardHookTest\KeyboardHookTest\KeyboardHookLib.cs

     文件       3792  2018-01-08 16:30  KeyboardHookTest\KeyboardHookTest\KeyboardHookTest.csproj

     文件       1453  2018-01-12 10:45  KeyboardHookTest\KeyboardHookTest\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6881  2018-01-12 15:20  KeyboardHookTest\KeyboardHookTest\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       1988  2018-01-12 15:22  KeyboardHookTest\KeyboardHookTest\obj\Debug\KeyboardHookTest.csproj.FileListAbsolute.txt

     文件        977  2018-01-12 15:21  KeyboardHookTest\KeyboardHookTest\obj\Debug\KeyboardHookTest.csproj.GenerateResource.Cache

     文件       2211  2018-01-08 16:23  KeyboardHookTest\KeyboardHookTest\obj\Debug\KeyboardHookTest.csprojResolveAssemblyReference.cache

     文件      11776  2018-01-12 15:21  KeyboardHookTest\KeyboardHookTest\obj\Debug\KeyboardHookTest.exe

     文件        180  2018-01-12 15:21  KeyboardHookTest\KeyboardHookTest\obj\Debug\KeyboardHookTest.Form1.resources

     文件      34304  2018-01-12 15:21  KeyboardHookTest\KeyboardHookTest\obj\Debug\KeyboardHookTest.pdb

     文件        180  2018-01-08 16:30  KeyboardHookTest\KeyboardHookTest\obj\Debug\KeyboardHookTest.Properties.Resources.resources

     文件        497  2018-01-08 16:16  KeyboardHookTest\KeyboardHookTest\Program.cs

     文件       1356  2018-01-08 16:16  KeyboardHookTest\KeyboardHookTest\Properties\AssemblyInfo.cs

     文件       2884  2018-01-08 16:16  KeyboardHookTest\KeyboardHookTest\Properties\Resources.Designer.cs

     文件       5612  2018-01-08 16:16  KeyboardHookTest\KeyboardHookTest\Properties\Resources.resx

     文件       1103  2018-01-08 16:16  KeyboardHookTest\KeyboardHookTest\Properties\Settings.Designer.cs

     文件        249  2018-01-08 16:16  KeyboardHookTest\KeyboardHookTest\Properties\Settings.settings

     文件       1017  2018-01-08 16:16  KeyboardHookTest\KeyboardHookTest.sln

    ..A..H.     39936  2018-01-12 15:15  KeyboardHookTest\KeyboardHookTest.v12.suo

     目录          0  2018-01-08 16:16  KeyboardHookTest\KeyboardHookTest\obj\Debug\TempPE

     目录          0  2018-01-12 15:19  KeyboardHookTest\KeyboardHookTest\bin\Debug

     目录          0  2018-01-12 15:21  KeyboardHookTest\KeyboardHookTest\obj\Debug

     目录          0  2018-01-12 15:19  KeyboardHookTest\KeyboardHookTest\bin

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

评论

共有 条评论