大网数据广告活动
启动与系统组件

IME may crash when processing a window message sent from another thread

· 52CE 我爱测

Describes the scenario where an Input Method Editor (IME) may crash when processing a window message sent from another thread, where the window procedure handling the message calls an Imm* function, such as ImmSetOpenStatus.

Describes a scenario where an Input Method Editor (IME) crashes while processing a window message sent from another thread, and where the window procedure handling the message calls an Imm* function such as ImmSetOpenStatus.

Symptoms

An application using an IME crashes under one of these conditions:

  • A user interface (UI) thread calls the TranslateMessage function as a part of the message loop.
  • Another thread sends a window message to a window owned by the UI thread.
  • The window procedure handling the window message sent by the other thread calls an Imm* function, such as ImmSetOpenStatus.

Cause

An IME included with Windows 10 may call the PeekMessage function when the IME is called by the TranslateMessage function to process a keyboard input. PeekMessage will process any pending window messages sent by other threads. This can result in a reentrancy issue when the window procedure processing the sent message calls an Imm* function and leaves the IME in an unexpected state.

Workaround

Avoid calling Imm* functions while the IME is processing another window message.

More information

The PeekMessage documentation contains the following:

During this call, the system delivers pending and non-queued messages sent to windows owned by the calling thread using the SendMessage, SendMessageCallback, SendMessageTimeout, or SendNotifyMessage function. The first queued message matching the specified filter is retrieved. The system may also process internal events. If no filter is specified, messages are processed in this order:

  • Sent messages
  • Posted messages
  • Input (hardware) messages and system internal events
  • Sent messages (again)
  • WM_PAINT messages
  • WM_TIMER messages

Note: Sent window messages are non-queued messages. The message filter specified when calling PeekMessage call doesn't apply to sent messages.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 06/11/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。