以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 C/C++编程思想 』  (http://bbs.xml.org.cn/list.asp?boardid=61)
----  WinAPI: GetKeyboardType - 获取键盘的类型信息  (http://bbs.xml.org.cn/dispbbs.asp?boardid=61&rootid=&id=87469)


--  作者:葛靖青001
--  发布时间:11/4/2010 4:47:00 PM

--  WinAPI: GetKeyboardType - 获取键盘的类型信息
GetKeyboardType(

  nTypeFlag: Integer {0:键盘类型; 1:键盘子类型; 2:功能键数量}

  ): Integer;

  //举例:

  procedure TForm1.FormCreate(Sender: TObject);

  var

  i: Integer;

  List: TStringList;

  begin

  List := TStringList.Create;

  List.Add('IBM PC/XT or compatible (83-key) keyboard');

  List.Add('Olivetti "ICO" (102-key) keyboard');

  List.Add('IBM PC/AT (84-key) or similar keyboard');

  List.Add('IBM enhanced (101/102-key) keyboard');

  List.Add('Nokia 1050 and similar keyboards');

  List.Add('Nokia 9140 and similar keyboards');

  List.Add('Japanese keyboard');

  i := GetKeyboardType(0);

  ShowMessage(List[i-1]);  {我这里返回: IBM enhanced (101/102-key) keyboard}

  i := GetKeyboardType(1);

  ShowMessage(IntToStr(i)); {这是厂商自定义数据, 这里返回: 0}

  i := GetKeyboardType(2);

  ShowMessage(IntToStr(i)); {返回: 12; 就是指 F1..F12}

  List.Free;

  end;


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
4,574.219ms