你如何使用输入法?

发布于 2024-07-11 10:38:23 字数 152 浏览 10 评论 0原文

我想制作一个处理用户输入的控件,所以我希望能够处理不同的键盘,其中一种方法是使用 IME。

如果您不处理它,当您激活 IME(例如激活日语书写)时,会出现一个浮动窗口。 我找到了需要处理的消息,但我不知道如何将捕获的键发送到 IME,以及何时获得有效的转换后的字符。

I want to make a control that handles user input, so I want to be able to handle different keyboards, and one of the ways is using IME.

If you don't handle it, there is a floating window that appears when you have IME active (for example japanese writing active). I found the messages that needs to be taken care of, but I don't know how to send the keys I'm trapping to the IME and when do I get a valid converted char.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

莫相离 2024-07-18 10:38:23

我是一名 Microsoft SDE,曾经维护(Windows 和 Office)韩语 IME 一段时间...

不幸的是,最好的 IME API 文档是由非 Microsoft 站点提供的:


以下是 Microsoft 官方文档:输入法管理器 (MSDN)

还有一个基于文本服务框架 (TSF) 的新的、更高级的 IME,Microsoft 将更喜欢你使用,但它更加复杂,并且旧的 API 模拟得很好。 如果您不需要任何高级功能(例如通过平板电脑/语音识别/更高级的 IME 等进行输入),那么使用旧的 API 就足够了。

关于文本服务框架的最佳文档是由另一位 Microsoft 开发人员编写的 TSF Aware 博客。 如果您走这条路,埃里克·布朗甚至可能亲自回答您的问题。

以下是 TSF 的 Microsoft 官方文档: 文本服务框架 (MSDN) )

您可能会发现 TSF 的一项有用功能是抑制 IME 渲染的能力(例如,需要渲染 IME 本身的全屏游戏)。 只需告诉 TSF 您的应用程序将呈现 IME GUI,然后实现一个空的呈现方法: UILess 模式概述 (MSDN)

I'm a Microsoft SDE that used to maintain the (Windows and Office) Korean IME for a while...

Unfortunately the best IME API documentation is provided by non-Microsoft sites:


Here is the official Microsoft documentation: Input Method Manager (MSDN)

There is also a new, more advanced IME based on the Text Services Framework (TSF) that Microsoft would prefer you to use, but it's even more complicated and the old API is emulated pretty well. If you don't need any of the advanced features (like input via tablet/voice recognition/fancier IME/etc) then using the old API is sufficient.

The best documentation on the Text Services Framework is the TSF Aware Blog written by another Microsoft dev. Eric Brown may even personally answer your questions if you go this route.

Here is the official Microsoft documentation for TSF: Text Services Framework (MSDN)

One feature of TSF you may find useful is the ability to suppress rendering of the IME (needed for full screen games that need to render the IME themselves, for example). Simply tell TSF that your app will render the IME GUI, then implement an empty rendering method: UILess Mode Overview (MSDN)

半透明的墙 2024-07-18 10:38:23

我认为您不想禁止显示 IME。 除了测试之外,我从未使用过其他工具,但据我了解,IME 是使用英文键盘输入非英文字符的预期/默认方式。

如果您正在编写一个控件并希望完全支持 IME,我认为您有两个选择:响应各种 Windows 消息(如 WM_IME_START_COMPOSITION、WM_IME_COMPOSITION 等)或使用文本服务框架 (TSF)。 据我了解,TSF 是未来,在 Vista 和 Windows 7 中,所有 IME 代码都基于 TSF,Windows 消息仍然存在,以便与旧程序兼容。

I don't think that you want to supress an IME from being displayed. I've never used one other than for testing, but it's my understanding that an IME is the expected/default way of entering non-English characters using an English keyboard.

If you are writing a control and want to fully support an IME, I think the two options that you have are to respond to the various Windows messages (like WM_IME_START_COMPOSITION, WM_IME_COMPOSITION, etc.) or use Text Services Framework (TSF). It's my understanding that TSF is the future, and in Vista and Windows 7 all of the IME code is based off of TSF, with the Windows messages still there for compatibility with old programs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文