Tuesday, February 09, 2010
 
    Search Web Link
Search Software
    
API Home » Keyboard » GetKeyboardLayoutName

GetKeyboardLayoutName

Category: Keyboard
Hits: 3266 Rating: GetKeyboardLayoutName has been rated 2.89 by  767 users (2.89) votes 767
Rate: 1-star  2-stars  3-stars  4-stars  5-stars
E-mail this API to friend E-mail this Code to a friend  save Bookmark this VB API Function
API Explanation
The GetKeyboardLayoutName function retrieves the name of the active keyboard layout.

Parameter Information
Declare Function GetKeyboardLayoutName Lib "user32" Alias "GetKeyboardLayoutNameA" (ByVal pwszKLID As String) As Long

· pwszKLID
Points to the buffer of at least KL_NAMELENGTH characters that is to receive the name of the keyboard layout, including the NULL terminator. This will be a copy of the string provided to the LoadKeyboardLayout function, unless layout substitution took place.

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.
Code



Const KL_NAMELENGTH = 9
Const KT_TYPE = 0
Const KT_SUBTYPE = 1
Const KT_FUNCTIONKEYS = 2
Private Declare Function GetKeyboardLayoutName Lib "user32" Alias "GetKeyboardLayoutNameA" _
(ByVal pwszKLID As String) As Long
Private Declare Function GetKeyboardType Lib "user32" (ByVal nTypeFlag As Long) As Long

Private Sub Form_Paint()
Dim strName As String
'Clear the form
Me.Cls
'Create a buffer
strName = String(KL_NAMELENGTH, 0)
'Get the keyboard layout name
GetKeyboardLayoutName strName
Me.Print "Keyboard layout name: " + strName
Select Case GetKeyboardType(KT_TYPE)
Case 1
Me.Print "Keyboard type: IBM PC/XT or compatible (83-key) keyboard"
Case 2
Me.Print "Keyboard type: Olivetti "ICO" (102-key) keyboard"
Case 3
Me.Print "Keyboard type: IBM PC/AT (84-key) or similar keyboard"
Case 4
Me.Print "Keyboard type: IBM enhanced (101- or 102-key) keyboard"
Case 5
Me.Print "Keyboard type: Nokia 1050 and similar keyboards"
Case 6
Me.Print "Keyboard type: Nokia 9140 and similar keyboards"
Case 7
Me.Print "Keyboard type: Japanese keyboard"
Case Else7
Me.Print "Keyboard type: Unknown"
End Select
Select Case GetKeyboardType(KT_FUNCTIONKEYS)
Case 1
Me.Print "Number of function keys: 10"
Case 2
Me.Print "Number of function keys: 12 (sometimes 18)"
Case 3
Me.Print "Number of function keys: 10"
Case 4
Me.Print "Number of function keys: 12"
Case 5
Me.Print "Number of function keys: 10"
Case 6
Me.Print "Number of function keys: 24"
Case 7
Me.Print "Number of function keys: Hardware dependent and specified by the OEM"
Case Else
Me.Print "Number of function keys: Unknown"
End Select
End Sub






HOME | ARTICLES | MUSIC | DOWNLOADS | LINK DIRECTORY |  GAMES | TEST-QUIZZES | SITEMAP | ABOUT | HELP
Copyright © 2000 - 2007 Ex-designz. All rights reserved. Website Developed By Dexter Zafra of Myasp-net.com
Link to us | Advertisement | Contact us | Privacy Policy | Terms of use | Accessibility