com.sun.jna.platform.win32.BaseTSD Java Examples

The following examples show how to use com.sun.jna.platform.win32.BaseTSD. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RobotDesktop.java    From SikuliX1 with MIT License 6 votes vote down vote up
private void doKeyRelease(int keyCode) {
  logRobot(stdAutoDelay, "KeyRelease: WaitForIdle: %s - Delay: %d");
  setAutoDelay(stdAutoDelay);
  // on Windows we detect the current layout in KeyboardLayout.
  // Since this layout is not compatible to AWT Robot, we have to use
  // the User32 API to simulate the key release
  if (Settings.AutoDetectKeyboardLayout && Settings.isWindows()) {
    int scanCode =  SXUser32.INSTANCE.MapVirtualKeyW(keyCode, 0);
    SXUser32.INSTANCE.keybd_event((byte)keyCode, (byte)scanCode, new WinDef.DWORD(WinUser.KEYBDINPUT.KEYEVENTF_KEYUP), new BaseTSD.ULONG_PTR(0));
  }else{
    keyRelease(keyCode);
  }

  if (stdAutoDelay == 0) {
    delay(stdDelay);
  }
  logRobot("KeyRelease: extended delay: %d", stdMaxElapsed);
}
 
Example #2
Source File: RobotDesktop.java    From SikuliX1 with MIT License 5 votes vote down vote up
private void doKeyPress(int keyCode) {
  Highlight fakeHighlight = null;
  if (RunTime.get().needsRobotFake()) {
    fakeHighlight = Highlight.fakeHighlight();
  }
  logRobot(stdAutoDelay, "KeyPress: WaitForIdle: %s - Delay: %d");
  setAutoDelay(stdAutoDelay);
  if (null != fakeHighlight) {
    delay(20);
    fakeHighlight.close();
    delay(20);
  }

  // on Windows we detect the current layout in KeyboardLayout.
  // Since this layout is not compatible to AWT Robot, we have to use
  // the User32 API to simulate the key press
  if (Settings.AutoDetectKeyboardLayout && Settings.isWindows()) {
      int scanCode =  SXUser32.INSTANCE.MapVirtualKeyW(keyCode, 0);
      SXUser32.INSTANCE.keybd_event((byte)keyCode, (byte)scanCode, new WinDef.DWORD(0), new BaseTSD.ULONG_PTR(0));
  }else{
    keyPress(keyCode);
  }


  if (stdAutoDelay == 0) {
    delay(stdDelay);
  }
  logRobot("KeyPress: extended delay: %d", stdMaxElapsed);
}
 
Example #3
Source File: WindowsUtils.java    From RemoteSupportTool with Apache License 2.0 5 votes vote down vote up
/**
 * Create keyboard input event.
 *
 * @param character character to print
 * @param flags     flags
 * @return keyboard input event
 */
private static WinUser.INPUT createKeyboardInput(char character, long flags) {
    WinUser.INPUT input = new WinUser.INPUT();
    input.type = new WinDef.DWORD(WinUser.INPUT.INPUT_KEYBOARD);
    input.input.setType("ki");
    input.input.ki = new WinUser.KEYBDINPUT();
    input.input.ki.wVk = new WinDef.WORD(0);
    input.input.ki.wScan = new WinDef.WORD(character);
    input.input.ki.time = new WinDef.DWORD(0);
    input.input.ki.dwFlags = new WinDef.DWORD(flags);
    input.input.ki.dwExtraInfo = new BaseTSD.ULONG_PTR();
    return input;
}
 
Example #4
Source File: Win32ProcessTools.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
public static BufferedImage getShellIcon(String path) {
    SHFILEINFO fi = new SHFILEINFO();
    BaseTSD.DWORD_PTR r = Shell32.INSTANCE.SHGetFileInfo(path, 0, fi, fi.size(), Shell32.SHGFI_ICON | Shell32.SHGFI_SMALLICON);
    if (r.intValue() == 0) {
        return null;
    }
    return iconToImage(fi.hIcon);
}
 
Example #5
Source File: User32.java    From Spark-Reader with GNU General Public License v3.0 votes vote down vote up
BaseTSD.LONG_PTR GetWindowLongPtr(Pointer hWnd, int index); 
Example #6
Source File: User32.java    From Spark-Reader with GNU General Public License v3.0 votes vote down vote up
BaseTSD.LONG_PTR GetWindowLong(Pointer hWnd, int index);