1 Star 0 Fork 48

doris123 / KeyMouseHook

forked from loamen / KeyMouseHook 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

nuget stable build license platforms 龙门信息①

c#(winform)模拟键盘按键和鼠标点击操作类库

English

简介

这是一个基于globalmousekeyhookInputSimulator 的类似于按键精灵的模拟键盘按键和鼠标点击操作的扩展类库。可以检测并记录键盘和鼠标的活动,你可以录制你的键鼠操作的记录并进行回放,可模拟键盘输入和鼠标点击操作。

环境

  • Windows: .Net Framework 4.0+

安装和源码

nuget install KeyMouseHook

使用

private readonly KeyMouseFactory eventHookFactory = new KeyMouseFactory(HookType.GlobalEvents);
private readonly KeyboardWatcher keyboardWatcher;
private readonly MouseWatcher mouseWatcher;
private List<MouseKeyEvent> _mouseKeyEvents;

public FormMain()
{
   InitializeComponent();

   keyboardWatcher = eventHookFactory.GetKeyboardWatcher();
   keyboardWatcher.OnKeyboardInput += (s, e) =>
   {
	if (_mouseKeyEvents != null)
	    _mouseKeyEvents.Add(e);
   };

   mouseWatcher = eventHookFactory.GetMouseWatcher();
   mouseWatcher.OnMouseInput += (s, e) =>
   {
	if (_mouseKeyEvents != null)
	    _mouseKeyEvents.Add(e);
   };
}

private void StartWatch(IKeyboardMouseEvents events = null)
{
    _macroEvents = new List<MacroEvent>();
    keyboardWatcher.Start(events);
    mouseWatcher.Start(events);
}

private void StopWatch()
{
   keyboardWatcher.Stop();
   mouseWatcher.Stop();
}

private void Playback()
{
   var sim = new InputSimulator();
   //var sim = new KeyMouseSimulator();
   sim.PlayBack(_macroEvents);
}

(源码里包含更详细的示例)

界面

c#(winform)模拟键盘按键和鼠标点击操作类库

鸣谢

贡献代码

  • Fork并克隆到本机
  • 创建一个分支并添加你的代码
  • 发送一个Pull Request

License

The MIT license see: LICENSE

The MIT License (MIT) Copyright (c) 2018 Loamen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

这是一个基于globalmousekeyhook 和 InputSimulator 的类似于按键精灵的模拟键盘按键和鼠标点击操作的扩展类库。可以检测并记录键盘和鼠标的活动,你可以录制你的键鼠操作的记录并进行回放,可模拟键盘输入和鼠标点击操作。 展开 收起
C#
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C#
1
https://gitee.com/doris12345/KeyMouseHook.git
git@gitee.com:doris12345/KeyMouseHook.git
doris12345
KeyMouseHook
KeyMouseHook
master

搜索帮助

14c37bed 8189591 565d56ea 8189591