gpt4 book ai didi

cocoa - OS X Cocoa - 将虚拟扫描代码与 Char 相互转换

转载 作者:行者123 更新时间:2023-12-03 17:06:24 25 4
gpt4 key购买 nike

Windows 上是否有相当于 VkKeyScan 和 ToUnicode 函数的 cocoa /碳,用于在虚拟扫描代码和 unicode 字符串之间进行转换?我还想执行反之亦然的转换(从字符到扫描码)。

最佳答案

遗憾的是,我不确定是否存在。 CGEventNSEvent (不是免费桥接,但 NSEvent 可以来回转换)是包括按键在内的事件的标准容器,因此可以从设备相关的扫描代码转换为 unicode 字符串序列但似乎没有办法走向另一个方向——从 unicode 字符到所需的设备相关按键序列。

下面有一条简短的评论 CGEventCreateKeyboardEvent那:

All keystrokes needed to generate a character must be entered, including modifier keys. For example, to produce a 'Z', the SHIFT key must be down, the 'z' key must go down, and then the SHIFT and 'z' key must be released:

但是随后显示的序列对于 Shift 和 z 键有硬编码且无法解释的常量。

关于cocoa - OS X Cocoa - 将虚拟扫描代码与 Char 相互转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7288391/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com