c++的Dos程序中怎么通过按下功能键F1后继续其他的动作?
++的Dos程序中怎么通过按下功能键F1后继续其他的动作?
如:
while()
char ch;
ch=getch();
if(ch==0x1b)
{exit(0);
}
if(ch==0x70)
{...
}0x70为F1的键码
可以运行后按F1没有反应,哪里错?应该怎么编辑代码?
最好能提供代码解释啊!Thanks for your help,,
[解决办法]
这个需要处理键盘消息
[解决办法]
F1是0x70吗,我测出来的怎么不是啊?
还有,我记得对于一些特殊的功能键,getch会返回0,然后马上再来一次getch,才会返回键盘扫描码。
[解决办法]
这是微软的MSDN上对getch的一段解释:
……When reading a function key or an arrow key, each function must be called twice; the first call returns 0 or 0xE0, and the second call returns the actual key code.
[解决办法]
用键盘检测:bioskey()
具体的用法,去查查就OK
[解决办法]
有这么一个获取键盘的函数。