IMEの種類を取得             <TOP>


IMEの種類を取得します。

GetKeyboardLayout キーボードレイアウトのハンドルを取得

ImmGetDescription IMEの種類を取得

 

 
 

'================================================================
'= IMEの種類を取得
'=    (ImmGetDescription.bas)
'================================================================
#include "Windows.bi"

' キーボードレイアウトのハンドルを取得
Declare Function Api_GetKeyboardLayout& Lib "user32" Alias "GetKeyboardLayout" (ByVal dwLayout&)

' IMEの種類を取得
Declare Function Api_ImmGetDescription& Lib "imm32" Alias "ImmGetDescriptionA" (ByVal hKL&, ByVal lpszDescription$, ByVal uBufLen&)

Var Shared Text1 As Object
Var Shared Text2 As Object
Var Shared Button1 As Object

Text1.Attach GetDlgItem("Text1") : Text1.SetFontSize 14
Text2.Attach GetDlgItem("Text2") : Text2.SetFontSize 14
Button1.Attach GetDlgItem("Button1") : Button1.SetFontSize 14

'================================================================
'=
'================================================================
Declare Sub Button1_on edecl ()
Sub Button1_on()
    Var hKeyLayout As Long
    Var IMEDescrpt As String * 128
    Var Ret As Long

    'キーボードレイアウトのハンドルを取得
    hKeyLayout = Api_GetKeyboardLayout(0)

    'IMEの種類を取得
    Ret = Api_ImmGetDescription(hKeyLayout, IMEDescrpt, Len(IMEDescrpt))

    'IMEの種類を表示
    Text2.SetWindowText Left$(IMEDescrpt, InStr(IMEDescrpt, Chr$(0)) - 1)
End Sub

'================================================================
'=
'================================================================
While 1
    WaitEvent
Wend
Stop
End