如何使用C ++创建Java JNI KeyListener [英] Howto make Java JNI KeyListener with C++
问题描述
我试图做一个程序,如AutoHotKey,但有一个图形界面。
我使用的是java.awt.Robot
现在我想让一个键来检查状态的代码(在AHK:getKeyState)
当然像一个KeyListener没有焦点。
我已经用JNI和C ++读了一些东西,但.... ....
我找不到一些信息。
I'm trying to make a program like AutoHotKey, but with a graphical interface. I'm using java.awt.Robot Now I want to make the code for checking the state from a key (In AHK: getKeyState) Of course somthing like a KeyListener without having focus. I read already something with JNI and C++, but.... I can't find some information.
有人可以帮助我吗? ?
Can somebody help me??
推荐答案
有很多好的JNI资源用于开始使用JNI Programming,如 Sun JNI Tutorial 。几乎所有的教程都假定有一个良好的C / C ++知识,因为Java本地接口(JNI)是本地C / C ++代码,Java虚拟机和其中运行的一切之间的桥梁(意味着你的Java字节码)。
There are lot of good JNI resources for starting out with JNI Programming like the Sun JNI Tutorial. Almost all Tutorials assume a good knowledge of C/C++ because the Java Native Interface (JNI) is the bridge between native C/C++ code, the Java Virtual Machine and everything running in there (meaning your Java Bytecode).
你可能想做的第一件事是找到一个关键的捕获库为您的操作系统的选择(你没有提到任何具体的)在C + +,尝试,以及检查如果已经有一些Java绑定(使用JNI并提供Java类的库)来进行交互。不幸的是,我没有找到任何有希望的快速搜索。
What you may want to do first is to find a key capturing library for your operating system of choice (you didn't mention anything specific here) in C++ and try that out as well as checking if there are already some Java bindings (libraries that use JNI and offer Java classes) to interact with. I didn't find any promising on a quick search unfortunately.
这篇关于如何使用C ++创建Java JNI KeyListener的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!