Example #1
0
 public static void Enable(IntPtr handle)
 {
     if (ImeModeConversion.InputLanguageTable != ImeModeConversion.UnsupportedTable)
     {
         IntPtr ptr = UnsafeNativeMethods.ImmGetContext(new HandleRef(null, handle));
         if (ptr == IntPtr.Zero)
         {
             if (originalImeContext == IntPtr.Zero)
             {
                 ptr = UnsafeNativeMethods.ImmCreateContext();
                 if (ptr != IntPtr.Zero)
                 {
                     UnsafeNativeMethods.ImmAssociateContext(new HandleRef(null, handle), new HandleRef(null, ptr));
                 }
             }
             else
             {
                 UnsafeNativeMethods.ImmAssociateContext(new HandleRef(null, handle), new HandleRef(null, originalImeContext));
             }
         }
         else
         {
             UnsafeNativeMethods.ImmReleaseContext(new HandleRef(null, handle), new HandleRef(null, ptr));
         }
         if (!IsOpen(handle))
         {
             SetOpenStatus(true, handle);
         }
     }
 }
Example #2
0
 public static void Disable(IntPtr handle)
 {
     if (ImeModeConversion.InputLanguageTable != ImeModeConversion.UnsupportedTable)
     {
         if (IsOpen(handle))
         {
             SetOpenStatus(false, handle);
         }
         IntPtr ptr = UnsafeNativeMethods.ImmAssociateContext(new HandleRef(null, handle), System.Windows.Forms.NativeMethods.NullHandleRef);
         if (ptr != IntPtr.Zero)
         {
             originalImeContext = ptr;
         }
     }
 }