取得電腦內裝有的輸入法名稱
請準備一個command button
Option Explicit
Private Declare Function GetKeyboardLayoutList Lib "user32" (ByVal
nBuff As Long, lpList As Long) As Long
Private Declare Function ImmGetDescription Lib "imm32.dll" Alias "ImmGetDescriptionA"
(ByVal hkl As Long, ByVal lpsz As String, ByVal uBufLen As Long) As Long
Private Declare Function ImmIsIME Lib "imm32.dll" (ByVal hkl As Long)
As Long
Dim IMEList() As Long
Private Sub Command1_Click()
Dim ret As Long
Dim n As Integer
Dim i As Integer
Dim StrName As String
ReDim IMEList(24) As Long
n = GetKeyboardLayoutList(25, IMEList(0))
ReDim Preserve IMEList(n - 1) As Long
For i = 0 To n - 1
If ImmIsIME(IMEList(i)) <> 0 Then
StrName = String(255, 0)
ret = ImmGetDescription(IMEList(i), StrName, 255)
StrName = Left(StrName, ret)
Print StrName
End If
Next i
End Sub