Beispiel #1
0
 public static void SetFocus()
 {
     if (!initd)
     {
         initd = true;
         TF_CreateThreadMgr(out tfThreadMgr);
     }
     tfThreadMgr?.SetFocus(IntPtr.Zero);
 }
Beispiel #2
0
        /// <summary>
        /// </summary>
        public static void DisableImmComposition(DispatcherObject dispatcher)
        {
            if (dispatcher == null)
            {
                throw new ArgumentNullException("dispatcher");
            }

            if (!_threadMgrFailed)
            {
                if (_threadMgr == null)
                {
                    Msctr.TF_CreateThreadMgr(out _threadMgr);

                    if (_threadMgr == null)
                    {
                        _threadMgrFailed = true;
                        return;
                    }
                }

                dispatcher.Dispatcher.BeginInvoke(
                    DispatcherPriority.Background
                    , new DispatcherOperationCallback(
                        delegate
                {
                    IntPtr ptr;
                    _threadMgr.GetFocus(out ptr);

                    if (ptr == IntPtr.Zero)
                    {
                        _threadMgr.SetFocus(_documentMgr);
                    }

                    return(null);
                }
                        )
                    , null
                    );
            }
        }