工控编程吧
标题:
上位机MFC如何获得键盘的类型
[打印本页]
作者:
qq263946146
时间:
2019-8-20 10:29
标题:
上位机MFC如何获得键盘的类型
void CDemoDlg::OnTest()
{
CString strText = _T("");
//获得键盘类型
int nType = ::GetKeyboardType(0);
if (nType == 1)
{
strText = _T("IBM PC/XT or compatible (83-key) keyboard");
}
else if (nType == 2)
{
strText = _T("Olivetti ICO (102-key) keyboard");
}
else if (nType == 3)
{
strText = _T("IBM PC/AT (84-key) or similar keyboard");
}
else if (nType == 4)
{
strText = _T("IBM enhanced (101- or 102-key) keyboard");
}
else if (nType == 5)
{
strText = _T("Nokia 1050 and similar keyboards");
}
else if (nType == 6)
{
strText = _T("Nokia 9140 and similar keyboards");
}
else if (nType == 7)
{
strText = _T("Japanese keyboard");
}
AfxMessageBox(strText);
}
复制代码
GetKeyboardType为实现功能的关键函数。
如上面的代码,我们可以添加按钮控件,来测试结果。
欢迎光临 工控编程吧 (https://www.gkbc8.com/)
Powered by Discuz! X3.4