How to control value type of wParam in WM_IME_CHAR
23:39 08 Nov 2023

I'm working on a C++ program that receives user's keyboard input on Windows 10. Users can input English and East Asian languages like Chinese using Input Methods and US keyboard.

The program gets WM_IME_CHAR messages when a user types Chinese via a Microsoft Input Method. The wParam values it receives are very different on two Windows 10 computers, with same keyboard input and same Input Method selection by a user.

To make a test, a user enters a same Chinese character on a keyboard on the two Windows 10 computers. On one computer, the wParam gives a character with GBK or GB2312 encoding, which I know how to handle. On the other computer the wParam seems always a small number 63, which I don't know what it is. I can't find any differences between the two computers. As far as I know all other software works the same on the two computers. For example, NotePad works the same on the two computers.

My goal is not to find out the differences of computer settings. My goal is to fix my program so that it receives the same correct input from both computers even if they may have different settings.

What could affect the type of values in wParam of a WM_IME_CHAR message? How is it controlled via Win32 or Windows API C/C++ calls?

The program was built in Visual Studio 2019, targeting 32-bit (x86) platform. The particular IME used in the test was Chinese Simplified - Microsoft Pinyin.

winapi ime