如何使用c#发送(keybd_event)Unicode密钥

时间:2015-07-12 17:35:10

标签: c# unicode keyboard

如何将所有Unicode密钥发送到' keybd_event' 。 。 ?

我找到了Alt + Unicode(十进制代码)'下面的方法和C ++代码

但是,我没有尝试过c#。

python
import gpp

1 个答案:

答案 0 :(得分:4)

不要使用keybd_event()。请改用SendInput()。它有一个KEYEVENTF_UNICODE标志用于此目的。您可以使用它发送实际的UTF-16代码单元(.NET char中的每个String都编码为UTF-16代码单元)。无需模拟 Alt + xxxx 代码。例如:

https://stackoverflow.com/a/30630477/65863

https://stackoverflow.com/a/15442914/65863

https://stackoverflow.com/a/8885228/65863