1,485
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
'By TZWSOHO
Private Const GCS_COMPSTR As Long = &H8
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 ImmGetCompositionString Lib "imm32.dll" Alias "ImmGetCompositionStringA" (ByVal hIMC As Long, ByVal dw As Long, ByRef lpv As Any, ByVal dw2 As Long) As Long
Private Sub Form_Load()
Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
End Sub
Private Sub tmrGetPY_Timer()
Dim hIMC As Long, BufSize As Long, Buf() As Byte
hIMC = ImmGetContext(hWnd)
BufSize = ImmGetCompositionString(hIMC, GCS_COMPSTR, ByVal 0&, 0)
If BufSize > 0 Then
ReDim Buf(BufSize - 1)
If ImmGetCompositionString(hIMC, GCS_COMPSTR, Buf(0), BufSize) Then
txtPY.Text = StrConv(Buf, vbUnicode)
End If
End If
Call ImmReleaseContext(hWnd, hIMC)
End Sub
Private Sub txtPY_GotFocus()
txtSrc.SetFocus
End Sub