简体   繁体   English

屏幕(虚拟)键盘在Win10中如何工作

[英]How does on-screen (virtual) keyboard works in Win10

I haven't find anything relevant in Google or any Microsoft site about it so I decided to ask a question here. 我在Google或任何Microsoft网站中都找不到与之相关的任何内容,因此我决定在此处提出一个问题。

Everybody knows that in Win-based OS there is a virtual keyboard . 大家都知道在基于Win的OS中有一个virtual keyboard I also know that *nix based OS, have it too. 我也知道基于* nix的操作系统也有。 So, the question is about: 因此,问题在于:

HOW DOES IT WORK INSIDE? 它在内部如何运作?

I mean, let's have an example that I opened on screen keyboard in Windows 10. What's the actual difference between: 我的意思是,让我们举一个我在Windows 10的on screen keyboard打开的示例。之间的实际区别是什么:

  1. input via hardware keyboard: when I'm using it, like I press X button 通过硬件键盘输入:使用时,就像按X按钮一样
  2. ..and using a virtual keyboard, when I press the same button ..并使用虚拟键盘,当我按下相同的按钮时

Imagine, I have an admin access to terminal/computer, is there any option to track/distinguish that in the second time I pressed button not on hardware keyboard, but on-screen (by mouse clicking) version of it? 想象一下,我对终端机/计算机具有管理员访问权限,是否有任何选项可以跟踪/区分第二次我不是在硬件键盘上按下按钮,而是在屏幕上(通过单击鼠标)版本?

And there are also many different software, like AutoIt ( yes, it's a language , but it's relevant to this example) that emulating pressing the X button . 而且还有很多不同的软件,例如AutoIt( 是的,这是一种语言 ,但与本示例相关),可以模拟pressing the X button How does they work in Win-based OS? 它们如何在基于Win的OS中工作? Do they "in-common" with default on-screen keyboard and using the same driver/WinAPI or there is a difference between them? 它们是否与默认的屏幕键盘“共用”并使用相同的驱动程序/ WinAPI,或者它们之间存在差异?

And the second case, between: 第二种情况是:

  1. default on-screen keyboard 默认的屏幕键盘
  2. compilated AutoIt script 编译的AutoIt脚本
  3. ..any other software that emulating press X button ..任何其他模拟press X button软件

I guess the only way to find out "how exactly button was pressed" is to check current processes list via taskmgr and find out have anything been launched or not. 我猜想找出“按下按钮的方式的唯一方法是通过taskmgr检查当前进程列表,并找出是否启动了任何东西。 Or I'm totally wrong here, and missing something? 还是我在这里完全错了,错过了什么?

THE SCOPE 范围

I have written a node.js script which emulates button pressing behaviour in windows app. 我编写了一个node.js脚本,该脚本模拟Windows应用程序中的按钮按下行为。

TL:DR business logic short => open notepad.exe and type `Hello world`

And could someone give me any advice/recommend any powershell/bat script ( or any other solution ) with demonstration of GetAsyncKeyState check behavior? 有人可以通过GetAsyncKeyState检查行为的演示给我任何建议/推荐任何powershell / bat脚本( 或任何其他解决方案 )吗? With which I could easily check my own node.js script (not by functional of it, but by triggering press the X button event) I found an answer for node.js case here: Detecting Key Presses Across Applications in Powershell 通过它我可以轻松地检查自己的node.js脚本(不是通过功能来检查,而是通过触发press the X button事件来触发),我在这里找到了node.js情况的答案: 在Powershell中检测跨应用程序的按键

SendInput is the preferred method to generate user input in software. SendInput是在软件中生成用户输入的首选方法。 The Windows on-screen keyboard probably uses it for everything except Ctrl+Alt+Delete which I believe has some kind of special handling. Windows屏幕键盘可能会将它用于除Ctrl + Alt + Delete以外的所有功能,我相信它具有某种特殊处理功能。 The on-screen keyboard is only able to generate Ctrl+Alt+Delete in certain configurations. 屏幕键盘仅在某些配置下才能生成Ctrl + Alt + Delete。

Software-generated input is merged with normal hardware input in the RIT (Raw Input Thread) in the kernel. 软件生成的输入与内核中RIT(原始输入线程)中的常规硬件输入合并。

A low-level keyboard hook can detect software-generated input. 低级键盘挂钩可以检测软件生成的输入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM