GetKeyboardType-獲取鍵盤(pán)的類型信息

字號(hào):

//聲明:
    GetKeyboardType(
    nTypeFlag: Integer {0:鍵盤(pán)類型; 1:鍵盤(pán)子類型; 2:功能鍵數(shù)量}
    ): 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)); {這是廠商自定義數(shù)據(jù), 這里返回: 0}
    i := GetKeyboardType(2);
    ShowMessage(IntToStr(i)); {返回: 12; 就是指 F1..F12}
    List.Free;
    end;