79527819

Date: 2025-03-22 17:31:10
Score: 0.5
Natty:
Report link

I've identified the root cause: the ITfMessagePump interface is blocked. Previously, my message loop implementation was referenced from the Windows-classic-samples/winui/tsfpad codebase. Through extensive debugging, I've confirmed this issue stems from an implementation flaw in the TSF ITfMessagePump component.

Currently, my message loop:

bool done = false;
while (!done)
{
    BOOL fResult = 0;
    if (pMessagePump->PeekMessageW(&msg, nullptr, 0, 0, PM_REMOVE, &fResult) != S_OK)
    {
        done = true;
    }

    if (fResult != FALSE)
    {
        continue;
    }

    if (::GetMessageW(&msg, nullptr, 0, 0) <= 0)
    {
        break;
    }
    if (IsImeWantMessage(msg, pKeystrokeMgr)) // use ITfKeystrokeMgr test message is consumed by IME
    {
        continue;
    }

    TranslateMessage(&msg);
    DispatchMessage(&msg);
    if (msg.message == WM_QUIT)
    {
        done = true;
    }
    if (done)
    {
        break;
    }
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: jamie