whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

53 Visitors Online


 
...retrieve information about the current keyboard?
Autor: Thomas Stutz
[ Print tip ]  

Tip Rating (6):  
     




// The GetKeyboardType function retrieves information about the current keyboard.

function KeyBoardType: string;
begin
  case 
GetKeyboardType(0) of
    
1: Result := 'IBM PC/XT or compatible (83-key) keyboard';
    2: Result := 'Olivetti "ICO" (102-key) keyboard';
    3: Result := 'IBM PC/AT (84-key) or similar keyboard';
    4: Result := 'IBM enhanced or compatible';
    5: Result := 'Nokia 1050 and similar keyboards';
    6: Result := 'Nokia 9140 and similar keyboards';
    7: Result := 'Japanese keyboard'
      else 
        
Result := 'Unrecognized keyboard type';
  end;
end;

function KeyBoardSubype: Integer;
begin
  
Result := GetKeyboardType(1);
end;

function NumberOfFunctionKeys: string;
begin
  case 
GetKeyboardType(3) of
    
1: Result := '20';
    2: Result := '12/18';
    3: Result := '10';
    4: Result := '12';
    5: Result := '10';
    6: Result := '24';
    7: Result := 'Hardware dependent'
      else 
        
Result := 'N/A';
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  
label1.Caption := Format('Keyboard Type: %s', [KeyBoardType]);
  Label2.Caption := Format('Keyboard Subtype: %d', [KeyBoardSubype]);
  Label3.Caption := Format('Keyboard Subtype: %s', [NumberOfFunctionKeys]);
end;

 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners