Di bawah ini merupakan procedure untuk mengetahui keyboard yang sedang digunakan.
Option Explicit
Private Declare Function GetKeyboardLayout Lib "user32" (ByVal dwLayout As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Public Sub KeyBoardLanguage()
Dim TheardId As Long
Dim TheardLang As Long
Dim processid As Long
TheardId = GetWindowThreadProcessId(hwnd, processid)
TheardLang = GetKeyboardLayout(ByVal TheardId)
TheardLang = TheardLang Mod 10000
Select Case TheardLang
Case "9721"
MsgBox "English"
Case "5425"
MsgBox "Arabic"
Case Else
MsgBox "I don't know atuh, cari weh ku anjeun sorangan", vbInformation, "Don't Know"
End Select
End Sub
Contoh penggunaan procedure di atas:
Private Sub Command1_Click()
KeyBoardLanguage
End Sub