[译]日记输入事件
By robot-v1.0
本文链接 https://www.kyfws.com/applications/journaling-input-events-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 3 分钟阅读 - 1090 个词 阅读量 0[译]日记输入事件
原文地址:https://www.codeproject.com/Articles/989/Journaling-Input-Events
原文作者:Plamen Petrov
译文由本站 robot-v1.0 翻译
前言
A tool for recording and playback of keyboard and mouse input
记录和回放键盘和鼠标输入的工具
介绍(Introduction)
这是使用Win32安装应用程序定义的挂钩过程的示例(This is an example for installing an application-defined hook procedures using Win32) SetWindowsHookEx()
功能.该项目仅实施(function. This project implements only) WH_JOURNALRECORD
和(and) WH_JOURNALPLAYBACK
钩子.我一直在寻找更多信息和示例程序,但我发现的唯一示例是Hooks32,这是一个旧的Win32项目.由于我没有在开发人员站点中找到有关这些问题的任何信息(我知道),所以我决定发布这个简单的工具.(hooks. I was looking for more information and sample programs, but the only sample I’d found was Hooks32, an old Win32 project.Because I didn’t find any information about these problems into the developer sites (which I know), I decided to publish this simple tool.)
该应用程序可用于自动化一些例行任务,例如-测试.启动目标应用程序,启动HookManager,然后按"开始录制"按钮.然后HookManager会最小化自身并开始跟踪键盘和鼠标事件.开始记录时,按CTRL + BREAK可以停止它.如果用户按下CTRL + ALT + DEL或CTRL + ESC,Windows将停止记录和回放(The application can be used to automate some routine tasks, for example - testing. Start the target application, launch the HookManager, and press the “Start Recording” button. Then HookManager minimizes itself and starts tracking keyboard and mouse events.When the recording is started, pressing CTRL+BREAK can stop it. Windows stops the recording and playback if the user presses CTRL+ALT+DEL or CTRL+ESC, which generates) WM_CANCELJOURNAL
系统消息.但是,在记录鼠标事件时要小心!记录的鼠标事件具有当前的指针坐标,如果关闭目标应用程序然后再次打开它,它将出现在不同的位置,因此鼠标事件将移到错误的位置.(system message. But, be careful when you are journaling the mouse events! The recorded mouse events are with the current pointer coordinates, and if you close the target application and open it again, it will appear on different position, so the mouse events will go to wrong place.)
可以扩展该工具以执行更多操作.例如:可以通过更改击键(具有不同的表单数据等)来编辑记录的事件.但这是非常精确的工作,因为每个按下的按钮都会生成2条消息-(This tool can be extended to do some more things. For example: the recorded events can be edited by changing the keystrokes (with different form data, etc.). But this is very precise work, because every pressed button generates 2 messages -) WM_KEYDOWN
和(and) WM_KEYUP
.生成的字符取决于其他按钮的状态-CTRL,SHIFT,CAPSLOCK等.(. The generated character depends from the state of other buttons - CTRL, SHIFT, CAPSLOCK, etc.)
我尚未在Windows NT上测试过该应用程序,但是使用Win98可以很好地工作.我将很高兴收到有关扩展功能的想法.(I haven’t tested the application on Windows NT yet, but with Win98 it works well. I will be glad to receive ideas about extending the functionality.)
Plamen Petrov,瓦尔纳,保加利亚(Plamen Petrov, Varna, Bulgaria)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ VC6 Windows Visual-Studio Dev 新闻 翻译