如何将虚拟密钥代码转换为字符代码?
在onkeydown()
处理程序中,我将获得219
作为'['';但是,“ ['是91
)的实际字符值。有什么方法可以映射这两个?
In the onkeydown()
handler I am getting 219
as the keycode for '['; however, the actual character value of '[' is 91
. Is there any way to map these two?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您使用的是Windows,则应查看 tounicodeex 功能。
If you are using Windows, you should look into the ToUnicodeEx function.
步骤1:打开VC ++ 6.0
步骤2:文件 - >新 - >项目 - > Win32应用程序
给您的项目名称
步骤3:文件 - >新 - >文件 - > C ++源文件
给您的文件名
步骤4:在您的CPP文件中
步骤5:项目 - >设置 - >选择MFC作为共享DLL
步骤6:BULID->编译
步骤7:构建 - >构建
步骤8:构建 - >执行
step 1: Open VC++ 6.0
Step 2: File --> New --> Projects --> Win32 Application
Give your project name
Step 3: File --> New --> Files --> C++ Source File
Give your file name
step 4: In your CPP file
step 5: Project --> settings --> Choose MFC as shared DLL
Step 6: Bulid --> Compile
step 7: Build --> Build
Step 8: Build --> Execute
mapVirtualKey()也很有用。
MapVirtualKey() is also useful.
您可以尝试使用
mapVirtualKey(UINT UCODE,UINT UMAPTYPE)
函数,该函数已内置在Windows.h库中。一个例子是:
或者
您可以通过 mapVirtualKeya函数(hinuser.h)
You can try using the
MapVirtualKey(UINT uCode,UINT uMapType)
function that is built into the Windows.h library.An example would be:
OR
You can read more at MapVirtualKeyA function (winuser.h)