views:

782

answers:

2

I want to make a control that handles user input, so I want to be able to handle different keyboards, and one of the ways is using IME.

If you don't handle it, there is a floating window that appears when you have IME active (for example japanese writing active). I found the messages that needs to be taken care of, but I don't know how to send the keys I'm trapping to the IME and when do I get a valid converted char.

A: 

I don't think that you want to supress an IME from being displayed. I've never used one other than for testing, but it's my understanding that an IME is the expected/default way of entering non-English characters using an English keyboard.

If you are writing a control and want to fully support an IME, I think the two options that you have are to respond to the various Windows messages (like WM_IME_START_COMPOSITION, WM_IME_COMPOSITION, etc.) or use Text Services Framework (TSF). It's my understanding that TSF is the future, and in Vista and Windows 7 all of the IME code is based off of TSF, with the Windows messages still there for compatibility with old programs.

Andy
+8  A: 

I'm a Microsoft SDE that used to maintain the (Windows and Office) Korean IME for a while...

Unfortunately the best IME API documentation is provided by non-Microsoft sites:


Here is the official Microsoft documentation: Input Method Manager (MSDN)

There is also a new, more advanced IME based on the Text Services Framework (TSF) that Microsoft would prefer you to use, but it's even more complicated and the old API is emulated pretty well. If you don't need any of the advanced features (like input via tablet/voice recognition/fancier IME/etc) then using the old API is sufficient.

The best documentation on the Text Services Framework is the TSF Aware Blog written by another Microsoft dev. Eric Brown may even personally answer your questions if you go this route.

Here is the official Microsoft documentation for TSF: Text Services Framework (MSDN)

One feature of TSF you may find useful is the ability to suppress rendering of the IME (needed for full screen games that need to render the IME themselves, for example). Simply tell TSF that your app will render the IME GUI, then implement an empty rendering method: UILess Mode Overview (MSDN)

Leftium