我正在尝试按照此链接隐藏默认的Windows IME Windows组合窗口&最终使其与专注的插入位置 - https://msdn.microsoft.com/en-us/library/windows/desktop/ee419002(v=vs.85).aspx即
一致我来自ChromiumWebBrowser
类,然后添加WndProd
钩子,我在Windows IME Messages
基本上,我想在操作系统执行任何默认处理之前处理IME事件
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "DefWindowProcW")]
public static extern IntPtr DefWindowProc(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
case WM_IME_SETCONTEXT:
var lp = (int)lParam;
// We handle the IME Composition Window ourselves (but let the IME Candidates
// Window be handled by IME through DefWindowProc()), so clear the
// ISC_SHOWUICOMPOSITIONWINDOW flag:
lp &= ~(ISC_SHOWUICOMPOSITIONWINDOW);
DefWindowProc(_ownerHWnd, msg, wParam, (IntPtr)lp);
这样,我可以将合成窗口正确放置在WPF CEF SHAPRP浏览器内输入框的焦点位置(插入位置)。 但每次启动时,都会出现由底层操作系统呈现的输入框。
一旦我完成此步骤以便不显示UI,那么我将捕获其他IME消息以定位COMPOSITION
UI
private const int WM_IME_COMPOSITION = 0x10F;
private const int WM_IME_SETCONTEXT = 0x281;
private const int WM_INPUTLANGCHANGE = 0x51;
private const int WM_IME_STARTCOMPOSITION = 0x010D;
private const int WM_IME_ENDCOMPOSITION = 0x010E;
目标是当您键入cjk characters
时记事本所做的事情,即它在焦点处内联窗口
有关如何在WPF
中解决此问题的任何想法吗?