TreeView‚Μ‚h‚l‚d§Œδ‚π‚΅‚ζ‚€II



Option Explicit

Private Declare Function ImmGetContext Lib "imm32.dll" ( _
    ByVal hwnd As Long _
) As Long

Private Declare Function ImmReleaseContext Lib "imm32.dll" ( _
    ByVal hwnd As Long, _
    ByVal hImc As Long _
) As Long

Private Declare Function ImmGetConversionStatus Lib "imm32.dll" ( _
    ByVal hImc As Long, _
    lpdw As Long, _
    lpdw2 As Long _
) As Long

Private Declare Function ImmSetConversionStatus Lib "imm32.dll" ( _
    ByVal hImc As Long, _
    ByVal dw1 As Long, _
    ByVal dw2 As Long _
) As Long


Private Const IME_CMODE_ALPHANUMERIC = &H0
Private Const IME_CMODE_CHARCODE = &H20
Private Const IME_CMODE_EUDC = &H200
Private Const IME_CMODE_FULLSHAPE = &H8
Private Const IME_CMODE_HANJACONVERT = &H40
Private Const IME_CMODE_KATAKANA = &H2
Private Const IME_CMODE_LANGUAGE = &H3
Private Const IME_CMODE_NATIVE = &H1
Private Const IME_CMODE_NOCONVERSION = &H100
Private Const IME_CMODE_ROMAN = &H10
Private Const IME_CMODE_SOFTKBD = &H80
Private Const IME_CMODE_SYMBOL = &H400
Private Const IME_CMODE_CHINESE = IME_CMODE_NATIVE
Private Const IME_CMODE_HANGEUL = IME_CMODE_NATIVE
Private Const IME_CMODE_JAPANESE = IME_CMODE_NATIVE

Private lpdw As Long
Private lpdw2 As Long

Private Sub cmdExit_Click()
    End
End Sub

Private Sub cmdIMEoff_Click()
    Dim hImc As Long
    
    hImc = ImmGetContext(trvTree.hwnd)
    lblState(1).Caption = hImc
    Call ImmGetConversionStatus(hImc, lpdw, lpdw2)
    Call ImmSetConversionStatus(hImc, 0, 0)
    Call ImmReleaseContext(trvTree.hwnd, hImc)
End Sub

Private Sub cmdIMEon_Click()
    Dim hImc As Long
    
    hImc = ImmGetContext(trvTree.hwnd)
    lblState(1).Caption = hImc
    Call ImmSetConversionStatus(hImc, lpdw, lpdw2)
    Call ImmReleaseContext(trvTree.hwnd, hImc)
End Sub

Private Sub Form_Load()
    Dim dwStyle As Long
    
    With trvTree
        Call .Nodes.Add(, , "root", "root")
        Call .Nodes.Add("root", tvwChild, "child1", "child1")
        Call .Nodes.Add("root", tvwChild, "child2", "child2")
        Call .Nodes.Add("root", tvwChild, "child3", "child3")
        Call .Nodes.Add("root", tvwChild, "child4", "child4")
    End With
    
    lpdw = IME_CMODE_ROMAN + IME_CMODE_FULLSHAPE + IME_CMODE_NATIVE
    lpdw2 = IME_CMODE_FULLSHAPE
End Sub

    

ƒTƒ“ƒvƒ‹ TreeViewIME.lzh