• 大小: 86KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-07-05
  • 语言: C#
  • 标签: 监听  C#  日志  

资源简介

监听键盘,并在D写log日志进行分析,其他功能可以自己添加。

资源截图

代码片段和文件信息

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

namespace KeyCatch
{
    public partial class Form1 : Form
    {
        private KeyboardHook kh;
        private ArrayList NumList;

        public Form1()
        {
            InitializeComponent();
            NumList = new ArrayList();
            kh = new KeyboardHook();
            kh.Filters = “91+82&92+82&164+9&165+9“;
            NumList.Add(“91+82“);
            NumList.Add(“92+82“);
            NumList.Add(“164+9“);
            NumList.Add(“165+9“);
        }
        //添加过滤
        private void button1_Click(object sender EventArgs e)
        {
            NewAction addnew = new NewAction();
            addnew.add += new AddNewAction(addnew_add);
            addnew.Show();
        }

        private void addnew_add(string actionstring num)
        {
            listBox1.Items.Add(action);
            NumList.Add(num);
        }
        //关闭窗口
        private void button4_Click(object sender EventArgs e)
        {
            this.Close();
        }
        //删除过滤
        private void button2_Click(object sender EventArgs e)
        {
            NumList.RemoveAt(listBox1.SelectedIndex);
            listBox1.Items.Remove(listBox1.SelectedItem);
        }
        //开始捕捉
        private void button5_Click(object sender EventArgs e)
        {
            kh.BeginHook();
            kh.OnKeyIntercepted += new KeyboardHook.KeyboardHookEventHandler(kh_OnKeyIntercepted);
        }

        private void kh_OnKeyIntercepted(string e)
        {
            textBox1.Text = e;
        }
        //停止捕捉
        private void button6_Click(object sender EventArgs e)
        {
            if (kh != null)
            {
                kh.Dispose();
            }
        }
        //应用
        private void button3_Click(object sender EventArgs e)
        {
            if (!kh.IsHooked)
            {
                string filter = ““;
                foreach (string s in NumList)
                {
                    filter += s + “&“;
                }
                kh.Filters = filter.Substring(0 filter.Length - 1);
            }
            else
            {
                MessageBox.Show(“请先停止捕获!“ “Error“);
            }
        }
    }
}

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

     文件       2493  2007-04-22 14:25  KeyCatch\Backup\KeyCatch\Form1.cs

     文件       7782  2007-04-22 14:18  KeyCatch\Backup\KeyCatch\Form1.Designer.cs

     文件       5814  2007-04-22 14:18  KeyCatch\Backup\KeyCatch\Form1.resx

     文件      10769  2007-04-22 14:59  KeyCatch\Backup\KeyCatch\KeyboardHook.cs

     文件       3625  2007-04-21 19:30  KeyCatch\Backup\KeyCatch\KeyCatch.csproj

     文件       2855  2007-04-22 12:42  KeyCatch\Backup\KeyCatch\NewAction.cs

     文件       5594  2007-04-21 17:22  KeyCatch\Backup\KeyCatch\NewAction.Designer.cs

     文件       5814  2007-04-21 17:22  KeyCatch\Backup\KeyCatch\NewAction.resx

     文件        373  2007-04-21 20:07  KeyCatch\Backup\KeyCatch\Program.cs

     文件       1278  2007-04-21 16:36  KeyCatch\Backup\KeyCatch\Properties\AssemblyInfo.cs

     文件       2843  2007-04-21 16:36  KeyCatch\Backup\KeyCatch\Properties\Resources.Designer.cs

     文件       5612  2007-04-21 16:36  KeyCatch\Backup\KeyCatch\Properties\Resources.resx

     文件       1091  2007-04-21 16:36  KeyCatch\Backup\KeyCatch\Properties\Settings.Designer.cs

     文件        249  2007-04-21 16:36  KeyCatch\Backup\KeyCatch\Properties\Settings.settings

     文件        913  2007-04-21 16:36  KeyCatch\Backup\KeyCatch.sln

    ..A..H.     17408  2007-04-22 19:47  KeyCatch\Backup\KeyCatch.suo

     文件      19456  2012-09-21 14:58  KeyCatch\KeyCatch\bin\Debug\KeyCatch.exe

     文件      36352  2012-09-21 14:58  KeyCatch\KeyCatch\bin\Debug\KeyCatch.pdb

     文件      14328  2012-09-24 13:55  KeyCatch\KeyCatch\bin\Debug\KeyCatch.vshost.exe

     文件        490  2007-07-21 02:33  KeyCatch\KeyCatch\bin\Debug\KeyCatch.vshost.exe.manifest

     文件       3745  2012-09-21 14:58  KeyCatch\KeyCatch\Form1.cs

     文件       7887  2012-09-21 14:58  KeyCatch\KeyCatch\Form1.Designer.cs

     文件       5814  2012-09-21 14:58  KeyCatch\KeyCatch\Form1.resx

     文件      10769  2007-04-22 14:59  KeyCatch\KeyCatch\KeyboardHook.cs

     文件       5653  2012-09-17 11:42  KeyCatch\KeyCatch\KeyCatch.csproj

     文件        544  2012-09-17 11:42  KeyCatch\KeyCatch\KeyCatch.csproj.user

     文件       2855  2007-04-22 12:42  KeyCatch\KeyCatch\NewAction.cs

     文件       5594  2007-04-21 17:22  KeyCatch\KeyCatch\NewAction.Designer.cs

     文件       5814  2007-04-21 17:22  KeyCatch\KeyCatch\NewAction.resx

     文件        963  2012-09-24 13:55  KeyCatch\KeyCatch\obj\Debug\KeyCatch.csproj.FileListAbsolute.txt

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

评论

共有 条评论