'На форме таймер (Timer1) и надпись (Label1)
Option Explicit
Private Declare Function GetKeyboardLayoutName Lib "user32" Alias _
"GetKeyboardLayoutNameA" (ByVal pwszKLID As String) As Long
Private Sub Form_Load()
Label1.Left = 0
Label1.Top = 0
Label1.AutoSize = True
Label1.BackColor = 8388608
Label1.ForeColor = 16777215
Timer1.Enabled = True
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
Dim a As Long
Dim r As String
Dim KeybLayoutName As String
KeybLayoutName = String(9, 0)
GetKeyboardLayoutName KeybLayoutName
'409 - английская, 419 - русская
a = Left$(KeybLayoutName, InStr(1, KeybLayoutName, Chr(0)) - 1)
If a = 409 Then
r = "English"
End If
If a = 419 Then
r = "Русский"
End If
Label1.Caption = r
End Sub
Сейчас этот форум просматривают: AhrefsBot и гости: 76