16,717
社区成员
发帖
与我相关
我的任务
分享
Private Function GetReverseConversion(ByVal AText As String) As String
Dim hIMC As IntPtr = WR_Imm32.ImmGetContext(Me.Handle)
Dim hKL As IntPtr = WR_Imm32.GetKeyboardLayout(0)
Dim list As New WR_Imm32.CANDIDATELIST
Dim dwSize As Integer = WR_Imm32.ImmGetConversionList(hKL, hIMC, AText, IntPtr.Zero, 0, WR_Imm32.GCL.REVERSE_LENGTH)
Dim BufList As IntPtr = Marshal.AllocHGlobal(dwSize)
WR_Imm32.ImmGetConversionList(hKL, hIMC, AText, BufList, dwSize, WR_Imm32.GCL.REVERSECONVERSION)
Marshal.PtrToStructure(BufList, list)
Dim buf(dwSize) As Byte
Marshal.Copy(BufList, buf, 0, dwSize)
Marshal.FreeHGlobal(BufList)
Dim os As Integer = list.dwOffset
Dim str As String = System.Text.Encoding.Unicode.GetString(buf, os, buf.Length - os - 3)
Return str
End Function