产生键盘事件击键
如何编写一个简单的 C 程序来产生键盘按键。
if ( condition ) {
KeyPress('A');
}
我正在 Ubuntu 8.10 Linux 操作系统上工作
How to make a simple C program which will produce keyboard key hits.
if ( condition ) {
KeyPress('A');
}
I am working on Ubuntu 8.10 Linux OS
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
这是一个使用 libxdo(来自 xdotool)的简单示例。 (警告:我是 xdotool 的作者)
Here's a simple example using libxdo (from xdotool). (Caveat: I am the xdotool author)
Xlib 中有
XTestFakeKeyEvent()
函数。您可以使用 Expect for c或 C++ 程序
There is
XTestFakeKeyEvent()
function from Xlib.You can USE Expect for c or C++ Programs
查看 xsendkey。 包含的源代码很短,因此您可以从中提取必要的部分到您的程序中。
Take a look at xsendkey. The sources are included and are short, so you extract the necessary parts from it into your program.
虽然这不是 C,但您可以很容易地在 Java 中生成按键:
Although this is not C, you can produce key hits in Java very easily:
看看 Swinput。
Have a look at Swinput.
通过 Xdotool 获取假按键事件
Get Fake Key Events by Xdotool