可以试试控制键盘按键,比如ctrl+空格转换输入法全角和半角,在C#中用程序按这两个按钮

解决方案 »

  1.   

    internal class ImeContext
    中的
    public static void SetImeStatus(ImeMode imeMode, IntPtr handle)
    最后有这么几句
    ImeModeConversion.ImeModeConversionBits[imeMode];
    IntPtr ptr1 = UnsafeNativeMethods.ImmGetContext(new HandleRef(null, handle));
    UnsafeNativeMethods.ImmGetConversionStatus(new HandleRef(null, ptr1), ref conversion, ref sentence);
    conversion |= conversion1.setBits;
    conversion &= ~conversion1.clearBits;
    UnsafeNativeMethods.ImmSetConversionStatus(new HandleRef(null, ptr1), conversion, sentence);
    UnsafeNativeMethods.ImmReleaseContext(new HandleRef(null, handle), new HandleRef(null, ptr1));
    --------------------------------
    其中conversion |= conversion1.setBits;就是C#编写的程序一切换输入法就是全角的罪魁祸首
    如果以conversion |= ((int)imeMode)==4? 1 | imeSharp :conversion1.setBits;替换就正常了所以这句关系全角的问题  以上为反编译代码
    我以前自己写IME输入时发现的 (当时啃了好久的代码。。)不知道能不能帮的上...
      

  2.   

    http://www.51testing.com/?117006/action_viewspace_itemid_65497.html
    这里有切换的函数