我有一个代码参考:
[System.Runtime.InteropServices.DllImport("imm32.dll")]
public static extern IntPtr ImmGetContext(IntPtr hWnd);
[System.Runtime.InteropServices.DllImport("imm32.dll")]
public static extern bool ImmGetConversionStatus(IntPtr hIMC, ref int conversion, ref int sentence);
[System.Runtime.InteropServices.DllImport("imm32.dll")]
public static extern bool ImmSetConversionStatus(IntPtr hIMC, int conversion, int sentence);
foreach (InputLanguage iL in InputLanguage.InstalledInputLanguages)
{
if (iL.LayoutName == "中文(简体) - 美式键盘")
{
InputLanguage.CurrentInputLanguage = iL;
break;
}
}
IntPtr prt = ImmGetContext(this.Handle);
int iMode = -2147483648;
int iSentence = 0;
以上代码尝试过,但失败了,求赐教!!!