Get info about keyboard

Posted in Manipulators

Use GetKeyboardType function. Parameter 0 of this function will allow to get keyboard type and parameter 2 will allow to get number of functional keys of your keyboard.

procedure TForm1.Button1Click(Sender: TObject);
var
  Str: string;
begin
  case GetKeyboardType(0) of
    1: 	Str:='IBM PC/XT or compatible (83-key) keyboard';
    2:	Str:='Olivetti "ICO" (102-key) keyboard';
    3:	Str:='IBM PC/AT (84-key) or similar keyboard';
    4:  Str:='IBM enhanced (101- or 102-key) keyboard';
    5:  Str:='Nokia 1050 and similar keyboards';
    6:  Str:='Nokia 9140 and similar keyboards';
    7:	Str:='Japanese keyboard';
  end;
  Label1.Caption:='Keyboard type is '+Str;

  case GetKeyboardType(2) of
    1,3,5: Str:='10';
    2,4: Str:='12';
    6: Str:='24';
    7: Str:='Hardware dependent and specified by the OEM';
    else Str:='N/A';
  end;
  Label2.Caption:='Number of functional keys is '+Str;
end;