等待按键 - WaitKey
函数简介
等待指定的按键按下(前台,不是后台)。
接口名称
WaitKey
DLL调用
int WaitKey(long ola, int vk_code, int time_out);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| vk_code | 整数型 | 等待的按键码。 |
| time_out | 整数型 | 等待超时时间,单位毫秒。 |
示例
C++
long instance = CreateCOLAPlugInterFace();
// 等待用户按下F1键,超时时间5000ms
int ret = WaitKey(instance, 0x70, 5000); // VK_F1 = 0x70
if (ret == 1) {
// F1被按下,开始执行操作
}
Python
# 待补充
返回值
- 1:指定的按键按下。
- 0:超时。
