views:

143

answers:

2

In my game code, I process key input by handling WM-KEYDOWN message. wParam gives me the keycode i need.

The problem is with IME, especially KoreanIME. I get WM-IME-COMPOSITION and then WM-KEYUP, but never the WM-KEYDOWN.

So, the bottom line is.. I need to get keycode when i receive WM-IME-COMPOSITION. Is there a way to do so?

Any help will be greatly appreciated. Thanks!

A: 

according to http://msdn.microsoft.com/en-us/library/dd374133(VS.85).aspx the composite key is in the wParam, encoded as DBCS (http://www.microsoft.com/typography/unicode/cs.htm). I guess you have to extract the appropriate byte from the word and decide according to that.

Tobias Langner
thanks! i think this is it!! i will try this out when i get back to work
wooohoh
I could extract an ascii code from DBCS if IME is not in the middle of composition. While in composition, no, i couldn't
wooohoh
In the end, i used ImmSimulateHotKey() to turn ime off when not needed, and turn it back on later.
wooohoh
I couldn't use ImmAssociateContext( hwnd, NULL ) because under some configuration, right after I call it, it will be reassociated automatically.
wooohoh
A: 

I know this is a bit late, but for the benefit of others, one could use

BOOL ImmDisableIME(
  __in  DWORD idThread
);

Pass the ID of the UI thread, the one which handles key presses.

http://msdn.microsoft.com/en-us/library/dd318535(v=VS.85).aspx

Vincent McNabb