Attribute VB_Name = "MVWLanguage" Option Explicit 'Hilfsmodul zur Sprachumschaltung '© 2000-2002, INOSOFT GmbH 'Version 4.04.000 'Funktionen: '-SetKeyboardLayout Sucht ein Tastaturlayout passend zur gewünschten Sprachkennung 'Abhängigkeiten/zusätzliche Dateien: ' keine Private Declare Sub keybd_event Lib "user32" _ (ByVal bVk As Byte, _ ByVal bScan As Byte, _ ByVal dwFlags As Long, _ ByVal dwExtraInfo As Long _ ) Private Const KEYEVENTF_EXTENDEDKEY = &H1 Private Const KEYEVENTF_KEYUP = &H2 Private Declare Function GetKeyboardLayout Lib "user32" _ (ByVal dwLayout As Long _ ) As Long Private Declare Function ActivateKeyboardLayout Lib "user32" _ (ByVal HKL As Long, _ ByVal Flags As Long _ ) As Long Private Const HKL_NEXT = 1 Public Sub SetKeyboardLayout(ByVal LCID As Long) 'Sucht ein Tastaturlayout passend zur gewünschten Sprachkennung 'Eingabe: ' LCID: gewünschte Sprachkennung (Windows locale identifier) Dim lKbLayoutFirst As Long, lKbLayout As Long Dim lLCID As Long Dim f As Boolean f = False lKbLayoutFirst = GetKeyboardLayout(0) lKbLayout = lKbLayoutFirst 'alle installierten Keyboard-Layouts durchlaufen Do lLCID = lKbLayout And &HFFFF& If lLCID = LCID Then 'und bei passendem Layout Schleife verlassen und Einstellung beibehalten. f = True Exit Do End If ActivateKeyboardLayout HKL_NEXT, 0 lKbLayout = GetKeyboardLayout(0) Loop Until lKbLayout = lKbLayoutFirst If Not f Then MsgBox "No Keyboard Layout found!", vbInformation + vbOKOnly End If End Sub