You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.6 KiB
QBasic

Attribute VB_Name = "MVWLanguage"
Option Explicit
'Hilfsmodul zur Sprachumschaltung
'<27> 2000-2002, INOSOFT GmbH
'Version 4.04.000
'Funktionen:
'-SetKeyboardLayout Sucht ein Tastaturlayout passend zur gew<65>nschten Sprachkennung
'Abh<62>ngigkeiten/zus<75>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<65>nschten Sprachkennung
'Eingabe:
' LCID: gew<65>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