Option Explicit
Const GCS_RESULTREADSTR = &H200
Private Sub Form_Load()
Me.txtMoji.Text = ""
Me.txtKana.Text = ""
Me.txtDummy.Text = ""
Me.txtMoji.IMEMode = 1
txtDummy.Visible = False
End Sub
Private Sub txtMoji_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift <> 0 Then Exit Sub
Dim hContext As Long
Dim nSize As Long
Dim A As String
Dim rc As Long
hContext = ImmGetContext(Me.hWnd)
nSize = ImmGetCompositionString(hContext, GCS_RESULTREADSTR, vbNullString, 0)
A = String(nSize, Chr(0))
rc = ImmGetCompositionString(hContext, GCS_RESULTREADSTR, A, nSize)
rc = ImmReleaseContext(Me.hWnd, hContext)
txtDummy.Text = Left(A, nSize)
End Sub
Private Sub txtDummy_Change()
txtKana.SelStart = Len(txtKana.Text)
txtKana.SelText = txtDummy.Text
txtKana.SelStart = Len(txtKana.Text)
End Sub