资源简介
最详尽的HooK钩子的使用例子,有各种钩子的使用方法,扑捉键盘和鼠标的动作之后,信息传递给窗体,在窗体中显示出完整的键盘操作履历

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsHook
{
public partial class Form1 : Form
{
public static Form1 form1;
public Form1()
{
InitializeComponent();
CheckForIllegalCrossThreadCalls = false;
form1 = this;
}
KeyBordHook kbh = new KeyBordHook();
MouseHook mh = new MouseHook();
private void button1_Click(object sender EventArgs e)
{
mh.Start();
mh.OnMouseActivity += new MouseEventHandler(mh_OnMouseActivity);
kbh.Start();
kbh.onkeydownEvent += new KeyEventHandler(kbh_onkeydownEvent);
kbh.onkeypressEvent += new KeyPressEventHandler(kbh_onkeypressEvent);
}
void mh_OnMouseActivity(object sender MouseEventArgs e)
{
this.label3.Text = “OnMouseActivity: “ + e.Button.ToString() + e.Location.ToString();
}
void kbh_onkeypressEvent(object sender KeyPressEventArgs e)
{
this.label1.Text = “onkeypressEvent: “ + e.KeyChar.ToString();
}
void kbh_onkeydownEvent(object sender KeyEventArgs e)
{
this.label2.Text = “onkeydownEvent: “ + e.KeyValue.ToString();
int index = this.dataGridView1.Rows.Add();
this.dataGridView1.Rows[index].Cells[0].Value = System.DateTime.Now;
this.dataGridView1.Rows[index].Cells[1].Value = ““;
this.dataGridView1.Rows[index].Cells[2].Value = e.KeyCode.ToString();
this.dataGridView1.Rows[index].Cells[3].Value = “X“;
this.dataGridView1.Rows[index].Cells[4].Value = “X“;
this.dataGridView1.Rows[index].Cells[5].Value = “X“;
this.dataGridView1.CurrentCell = this.dataGridView1.Rows[index].Cells[0];
}
private void button3_Click(object sender EventArgs e)
{
mh.OnMouseActivity -= new MouseEventHandler(mh_OnMouseActivity);
kbh.onkeydownEvent -= new KeyEventHandler(kbh_onkeydownEvent);
kbh.onkeypressEvent -= new KeyPressEventHandler(kbh_onkeypressEvent);
kbh.Stop();
mh.Stop();
this.dataGridView1.Rows.Clear();
}
private void dataGridView1_CellContentClick_1(object sender DataGridViewCellEventArgs e)
{
}
public void drawShift() {
this.dataGridView1.Rows[this.dataGridView1.RowCount-2].Cells[3].Value = “O“;
this.dataGridView1.Rows[this.dataGridView1.RowCount-2].Cells[4].Value = “X“;
this.dataGridView1.Rows[this.dataGridView1.RowCount-2].Cells[5].Value = “X“;
}
public void drawCtrl()
{
this.dataGridView1.Rows[this.dataGridView1.RowCount - 2].Cells[3].Value = “X“;
this.dataGridView1.Rows[this.dataGridView1.RowCount - 2].C
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-03-27 15:38 WindowsHook\
目录 0 2019-03-27 15:38 WindowsHook\Backup\
文件 1241 2009-06-06 08:39 WindowsHook\Backup\Form1.cs
文件 3469 2009-06-06 08:39 WindowsHook\Backup\Form1.Designer.cs
文件 5814 2009-06-06 08:39 WindowsHook\Backup\Form1.resx
文件 9624 2009-06-06 08:34 WindowsHook\Backup\KeyBordHook.cs
文件 9010 2009-06-06 08:23 WindowsHook\Backup\MouseHook.cs
文件 395 2009-06-05 13:26 WindowsHook\Backup\Program.cs
目录 0 2019-03-18 14:39 WindowsHook\Backup\Properties\
文件 3311 2009-06-06 08:40 WindowsHook\Backup\WindowsHook.csproj
文件 910 2009-06-05 13:26 WindowsHook\Backup\WindowsHook.sln
文件 15872 2009-06-06 08:40 WindowsHook\Backup\WindowsHook.v11.suo
目录 0 2019-03-27 15:38 WindowsHook\bin\
目录 0 2019-03-27 15:38 WindowsHook\bin\Debug\
文件 33792 2019-03-20 19:58 WindowsHook\bin\Debug\WindowsHook.exe
文件 52736 2019-03-20 19:58 WindowsHook\bin\Debug\WindowsHook.pdb
文件 21464 2019-03-26 09:19 WindowsHook\bin\Debug\WindowsHook.vshost.exe
文件 490 2013-06-18 20:28 WindowsHook\bin\Debug\WindowsHook.vshost.exe.manifest
目录 0 2019-03-27 15:38 WindowsHook\bin\Release\
文件 15872 2019-03-18 18:35 WindowsHook\bin\Release\WindowsHook.exe
文件 32256 2019-03-18 18:35 WindowsHook\bin\Release\WindowsHook.pdb
文件 21464 2019-03-18 18:35 WindowsHook\bin\Release\WindowsHook.vshost.exe
文件 490 2013-06-18 20:28 WindowsHook\bin\Release\WindowsHook.vshost.exe.manifest
文件 3629 2019-03-20 19:58 WindowsHook\Form1.cs
文件 7439 2019-03-20 08:40 WindowsHook\Form1.Designer.cs
文件 6918 2019-03-20 08:40 WindowsHook\Form1.resx
文件 12800 2019-03-19 09:49 WindowsHook\KeyBordHook.cs
文件 8692 2019-03-19 09:43 WindowsHook\MouseHook.cs
目录 0 2019-03-27 15:38 WindowsHook\obj\
目录 0 2019-03-27 15:38 WindowsHook\obj\Debug\
文件 1229 2019-03-18 16:51 WindowsHook\obj\Debug\DesignTimeResolveAssemblyReferences.cache
............此处省略35个文件信息
相关资源
- 虚拟鼠标
-
Actionsc
ript 1.0实现能跟随鼠标运动的 - 多窗口后台鼠标连点器
- 键盘记录器7.1 绿色注册版(破解版)
- HOOK小工具(进程、窗口、全局)
- js鼠标经过选项卡
- Qt Creator opengl实现四元数鼠标控制轨迹
- [免费]msp430f149控制PS2键盘并用1602显示
- web js虚拟键盘(中英文切换)
- 会变色的鼠标指针,颜色随时在变哦
- HOOK 记录和模拟 Keyboard Mouse
- CH454键盘与数码管显示程序
- 通用注入工具无驱版(HOOK注入、远程
- Diskhook(模拟硬盘序列号)
- 经典近乎绝迹的苹果变色鼠标指针
- VC 实现鼠标画矩形和绘制直线
- 基于Filter-Hook Driver的个人防火墙
- 键盘输入监控
- 8051单片机教程第二十六课:矩阵式键
- imx6q ch452驱动矩阵键盘扫描
- ch452串口键盘驱动程序
- 基于89C51计算机锁定加密键盘设计
- AresonMouseTestProgram可测鼠标回报率及
- 多窗口后台鼠标连点器.rar
- verilog 4×4矩阵键盘
- 虚拟数字键盘,自动跳转输入框,输
- 无电池近场通信 NFC 键盘设计方案
- 无电池近场通信 (NFC) 键盘设计方案
- 基于NFC无电池键盘设计方案
- 新贵GX1pro鼠标驱动 v1.0 官方版
评论
共有 条评论