VB Tips Vol.56
IMEの種類を取得する


Option Explicit

Private Declare Function
GetKeyboardLayout Lib "User32.dll" (ByVal dwLayout 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 Sub Command1_Click()
Dim
ckbh As Long
Dim
IMEType As String * 128
Dim
Ret As Long

'キーボードのハンドルを取得します
ckbh = GetKeyboardLayout(0)

Ret = ImmGetDescription(ckbh, IMEType, Len(IMEType))

Label1.Caption = Left(IMEType, InStr(IMEType, vbNullChar) - 1)

End Sub

サンプルプログラムのダウンロード(5.11KB)
※このページの内容とサンプルプログラムのコードは多少異なる場合があります。


戻る ホーム