Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Change Keyboard from Dvorak to EN?

Change Keyboard from Dvorak to EN?

Change Keyboard from Dvorak to EN?

I use Dvorak and it drives my boss crazy when he needs to remote into my machine.

I'd like to write a batchfile or VBScript to toggle the keyboard mapping since going through the Control Panel -> Regional Settings -> etc. is a pain, but I can't find anything on how to do this. (I could use AutoHotKey but since that involves remapping every key I feel that doing a registry change would be preferable).

I searched the registry for 'Dvorak' and found an entry with 'input.dll,-5092' in it, and 'English' was there as well with an entry of 'input.dll,-5000'...I was hoping that somehow I could just call that DLL via the command-line to switch the input but I haven't figured it out.

Editing the registry via VBS would be an option too but again I'm not sure what I need to change.

Any help would be most appreciated, esp with code. Thanks!

RE: Change Keyboard from Dvorak to EN?

I am not sure if this is what you want, but here an example I found in API-Guide:


'This example was created by A.E.Veltstra

'This fucntion changes the locale and as a result, the keyboardlayout gets adjusted

'parameters for api's
Const KL_NAMELENGTH As Long = 9                      'length of the keyboardbuffer
Const KLF_ACTIVATE  As Long = &H1                     'activate the layout

'the language constants
Const LANG_NL_STD As String = "00000413"
Const LANG_EN_US As String = "00000409"
Const LANG_DU_STD As String = "00000407"
Const LANG_FR_STD As String = "0000040C"

'api's to adjust the keyboardlayout
Private Declare Function GetKeyboardLayoutName Lib "user32" Alias "GetKeyboardLayoutNameA" (ByVal pwszKLID As String) As Long
Private Declare Function LoadKeyboardLayout Lib "user32" Alias "LoadKeyboardLayoutA" (ByVal pwszKLID As String, ByVal flags As Long) As Long
Public Function SetKbLayout(strLocaleId As String) As Boolean
    'Changes the KeyboardLayout
    'Returns TRUE when the KeyboardLayout was adjusted properly, FALSE otherwise
    'If the KeyboardLayout isn't installed, this function will install it for you
    On Error Resume Next
    Dim strLocId As String 'used to retrieve current KeyboardLayout
    Dim strMsg As String   'used as buffer
    Dim lngErrNr As Long   'receives the API-error number

  'create a buffer
  strLocId = String(KL_NAMELENGTH, 0)
  'retrieve the current KeyboardLayout
  GetKeyboardLayoutName strLocId
  'Check whether the current KeyboardLayout and the
  'new one are the same
  If strLocId = (strLocaleId & Chr(0)) Then
    'If they're the same, we return immediately
    SetKbLayout = True
    'create buffer
    strLocId = String(KL_NAMELENGTH, 0)
    'load and activate the layout for the current thread
    strLocId = LoadKeyboardLayout((strLocaleId & Chr(0)), KLF_ACTIVATE)
    If IsNull(strLocId) Then  'returns NULL when it fails
      SetKbLayout = False
    Else 'check again
      'create buffer
      strLocId = String(KL_NAMELENGTH, 0)
      'retrieve the current layout
      GetKeyboardLayoutName strLocId
      If strLocId = (strLocaleId & Chr(0)) Then
        SetKbLayout = True
        SetKbLayout = False
      End If
    End If
  End If
End Function
Private Sub Form_Load()
    'change the current keybour layout to 'English - US'
    SetKbLayout LANG_EN_US
End Sub

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close