Created
September 11, 2015 05:01
-
-
Save Jire/120918bdcd6cc29c0fbb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package abendigo.mem.jna; | |
import com.sun.jna.Native; | |
/** | |
* This direct-mapped JNA utility offers access to the <em>user32</em> module on <em>Windows</em>. | |
* | |
* @author Thomas G. P. Nappo (Jire) | |
* @author Jonathan Beaudoin (Jonatino) | |
*/ | |
public final class User32 { | |
/** | |
* Determines whether a key is up or down at the time the function is called, and whether | |
* the key was pressed after a previous call to {@link #GetAsyncKeyState(int)}. | |
* | |
* @param vKey The virtual-key code. | |
* @return If the function succeeds, the return value specifies whether the key was pressed since | |
* the last call to <strong>GetAsyncKeyState</strong>, and whether the key is currently up or down. | |
* If the most significant bit is set, the key is down, and if the least significant bit is set, | |
* the key was pressed after the previous call to <strong>GetAsyncKeyState</strong>. | |
*/ | |
public static native short GetAsyncKeyState(int vKey); | |
/** | |
* Retrieves the status of the specified virtual key. The status specifies whether the key is | |
* up, down, or toggled (on, off—alternating each time the key is pressed). | |
* | |
* @param vKey A virtual key. If the desired virtual key is a letter or digit (A through Z, a through z, or 0 through 9), | |
* this parameter must be set to the ASCII value of that character. For other keys, it must be a virtual-key code.<p /> | |
* If a non-English keyboard layout is used, virtual keys with values in the range ASCII A through Z and 0 through 9 | |
* are used to specify most of the character keys. For example, for the German keyboard layout, the virtual key of value | |
* ASCII O (0x4F) refers to the "o" key, whereas VK_OEM_1 refers to the "o with umlaut" key. | |
* @return The return value specifies the status of the specified virtual key, as follows:<br /> | |
* <ul> | |
* <li>If the high-order bit is 1, the key is down; otherwise, it is up.</li> | |
* <li>If the low-order bit is 1, the key is toggled. A key, such as the CAPS LOCK key, is toggled if it is turned on. | |
* The key is off and untoggled if the low-order bit is 0. A toggle key's indicator light (if any) on the keyboard will | |
* be on when the key is toggled, and off when the key is untoggled.</li> | |
* </ul> | |
*/ | |
public static native short GetKeyState(int vKey); | |
static { | |
Native.register("User32"); | |
} | |
private User32() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment