找传奇、传世资源到传世资源站!

C# 模拟自动 按键 实例源码

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

C# 模拟自动 按键 实例源码 Windows系统编程-第1张 C# 模拟自动 按键 实例源码 Windows系统编程-第2张
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace AutoKeyTool{ public partial class FrmMain : Form { KeyboardHook kh; public FrmMain() { InitializeComponent(); } private void btnStart_Click(object sender, EventArgs e) { this.timerClick.Enabled = true; } private void timerClick_Tick(object sender, EventArgs e) { MouseHook.MouseClick(); if (this.cbEnter.Checked) { SendKeys.Send("{ENTER}"); //模拟键盘输入ENTER } } private void btnPouse_Click(object sender, EventArgs e) { this.timerClick.Enabled = false; } private void FrmMain_Load(object sender, EventArgs e) { kh = new KeyboardHook(); kh.SetHook(); kh.OnKeyDownEvent = kh_OnKeyDownEvent; } void kh_OnKeyDownEvent(object sender, KeyEventArgs e) { //if (e.KeyData == (Keys.S | Keys.Control)) { this.Show(); }//Ctrl S显示窗口 //if (e.KeyData == (Keys.H | Keys.Control)) { this.Hide(); }//Ctrl H隐藏窗口 //if (e.KeyData == (Keys.C | Keys.Control)) { this.Close(); }//Ctrl C 关闭窗口 //Ctrl F11 开始点击 if (e.KeyData == (Keys.F11 | Keys.Control)) { this.timerClick.Enabled = true; } //Ctrl F12 暂停点击 if (e.KeyData == (Keys.F12 | Keys.Control)) { this.timerClick.Enabled = false; } } private void FrmMain_FormClosed(object sender, FormClosedEventArgs e) { kh.UnHook(); } private void FrmMain_Shown(object sender, EventArgs e) { this.cBMouse.Checked = true; } private void labLinkAbout_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { using (FrmAbout fAbout = new FrmAbout()) { fAbout.ShowDialog(); } } }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复