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;

 
 
 
 
 

 

 
  

你可能感兴趣的:(WinAPI: GetKeyboardType - 获取键盘的类型信息)