如何使用 JAVA 关闭或最小化屏幕上的 Windows 10 键盘



我尝试执行任务杀死以关闭Windows 10(OSK.exe)中的屏幕键盘,但是OSK在Windows 10中的行为似乎有所不同......虽然我可以启动应用程序,但我不能像以前那样使用taskkill关闭它。 即使在命令提示符下,我也会收到拒绝访问错误...我会满足于至少最小化它的能力,但这是我不知道该怎么做的事情。有什么建议吗?我的加工线看起来像这样

public void onScreenKbdMain_click1(GImageButton source, GEvent event) { 
  println("onScreenKbdMain - GImageButton >> GEvent." + event + " @ " + millis());
  if (keyboardOnOff == false) {
    sentense="Onscreen keyboard activated";
    String[] params = { 
      "C:/bala/bala.exe", "-t", sentense
    }; 
    launch(params);
    //pKeyboard = open(new String[] { "c:/Windows/system32/osk.exe" } ); // Windows Keyboard
    pKeyboard = launch(new String[] { 
      "osk"
      } 
      ); // Windows Keyboard
    keyboardOnOff=!keyboardOnOff;
    //println("keyboardOnOff= "+keyboardOnOff);
  } else {
    sentense="Onscreen keyboard disabled";
    String[] params = { 
      "C:/bala/bala.exe", "-t", sentense
    }; 
    launch(params);
    pKeyboard = launch(new String[] { 
      "taskkill IM/osk.exe/T/F"
      } 
      ); // Windows Keyboard
    keyboardOnOff=!keyboardOnOff;
    //println("keyboardOnOff= "+keyboardOnOff);
  }
}

在这里查看我的答案:https://stackoverflow.com/a/71410876/12346089 使用的是 TabTip.exe 而不是 osk.exe但它可能对您有用。

最新更新