0

In an older Win32 non-unicode app, I've got a text editor that handles IME in the following messages -

WM_IME_COMPOSITION:
...
if (lParam & GCS_RESULTSTR)  // flag to say the IME character has been fully entered

We then populate a struct getting the data from

ImmGetCompositionStringW

Then we receive a WM_IME_CHAR message. This is passed on to the 'normal' text handler and ends up populating the text box with the data we retrieved earlier.

That's it, it's worked for 25 years so far.

However, entering Korean in Windows 11 does not work (Windows 10 does work). Korean IME in Windows needs two key presses for each character; the app sees the WM_IME_COMPOSITION and WM_IME_CHAR messages only after the 2nd key is pressed to complete the character.

After the first character is complete, WM_IME_ .... messages are no longer received. They've just stopped coming. The text box receives other messages as expected (eg WM_KEYDOWN). Catching it in the debugger often makes it work again.

Can anyone suggest what might be failing?

3
  • Are you able to add a try catch block around this code and let us know what the error message is please Commented Sep 13, 2024 at 7:55
  • @SimonPrice There's no error to handle (it's c so I haven't got try .. catch anyway). Perhaps an API is returning an error. The messages are all posted and handled by the usual Windows APIs. I don't think the message queue is full / broken. Commented Sep 13, 2024 at 8:14
  • I think I'm getting similar behaviour to this stackoverflow.com/questions/48093581/… it could be some loss of focus from the IME device. Commented Sep 13, 2024 at 10:13

1 Answer 1

0

OK, not a complete understanding but it's to do with how IME finishes composing a character In Windows 11 (in my non-unicode Win32 app) entering Korean characters (Hangul) you now need to press the Space bar to complete the character entry, because some characters are contextual and rely on multiple keyboard entries to complete eg the keyboard sequence ‘G’ ㅎ ‘N’ 후 ‘G’ 훟 produces a single character. ‘G’ ‘Space’ ‘N’ ‘Space’ ‘G’ ‘Space’ enters this ㅎ ㅜ ㅎ

It's not very user friendly in my UI for it to stop accepting characters, I haven't got a solution to that (I've tried adding a timer and SendMessage (..., WM_CHAR, 32, 0) to simulate a space bar press but it gives odd results).

Sign up to request clarification or add additional context in comments.

1 Comment

Please accept your answer if the solution works for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.