public static void SetFocus() { if (!initd) { initd = true; TF_CreateThreadMgr(out tfThreadMgr); } tfThreadMgr?.SetFocus(IntPtr.Zero); }
/// <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 ); } }