无论如何,我可以使用GetAsyncKeyState来检测"~"吗?
Is there anyway i can detect "~" by using GetAsyncKeyState?
通过使用GetAsyncKeyState
它无法检测到'~'
按钮(在键盘的左上角(。
那么有什么方法可以检测这个按钮吗?
还是我应该使用另一个命令?
顺便说一下,我正在使用c ++
"~"的虚拟键码是VK_OEM_3
。
可以参考更多虚拟键代码:
https://learn.microsoft.com/en-us/windows/desktop/inputdev/virtual-key-codes
如何使用,请参考MSDN
一个简单的例子:
#include <Windows.h>
#include <iostream>
using namespace std;
int main()
{
BOOL OEM_3 = FALSE;
while (1)
{
if (GetAsyncKeyState(VK_OEM_3) < 0 && OEM_3 == false)
{
//Press down
OEM_3 = true;
cout << "Press down" << endl;
}
if (GetAsyncKeyState(VK_OEM_3) >= 0 && OEM_3 == true)
{
//Release
OEM_3 = false;
cout << "Release" << endl;
}
}
return 0;
}
相关文章:
- 使用CMake检测支持的C++标准
- 当套接字连接断开时检测C/C++Unix
- C/C++预处理器是否可以检测一些编译器选项
- WMI检测进程创建事件-c++
- 基于树莓pi的tensorflow lite量化ssd目标检测
- 下面是我为检测链接列表中的循环而制作的代码
- 落砂模拟碰撞检测C++和SFML
- 我可以检测和更改 gcc/g++ 中结构的当前数据对齐设置吗?
- 为什么C++编译器没有检测到正确声明的类?
- 检测win32服务创建和删除的最佳方法
- 正在LLVM中检测整数比较条件
- 如何在鼠标挂钩过程中检测拖动
- 位移操作和位掩码未检测到重复字符
- 检测 COFF 对象文件中C++内联符号
- qmake:检测目标位宽(32 位或 64 位)
- 增强精神解析器规则以检测语句中的特殊结尾
- 用于C++的静态二进制检测或二进制重写工具和框架
- Tensorflow对象检测在Python和C++(OpenCV)之间有不同的结果
- C++中的张量流对象检测
- 如何在OpenCV中检测这是谁的脸?