IME Sample: Demonstrates How to Control IME Mode and Implement IME Level 3

The IME sample uses CIMEEdit, a subclass of CEdit, to create an edit control. CIMEEdit handles all input characters, and it composes DBCS strings. The sample has the following features:

  • It shows how to control IME mode using C/C++. You can set the initial IME mode of CIMEEdit as to input language, shape, and so on. If you want your edit control initially set to get Korean characters, you can add code as in this sample. Also, if you want only English, you can disable IME.

  • It also shows how to implement IME level 3 in your source code. IME level 3 is more convenient and powerful for East Asian users. You can create a custom control or window that supports IME level 3 using this sample.

  • This sample determines the font and code page used for Ansi-Unicode conversion by the keyboard layout so that you can try four different IMEs for all East Asian languages without changing either font or code page. This is a feature of Windows 2000 and is not a requirement for support of IME level 3.

  • The function GetCombinedCharLength supports only surrogate characters in this sample. If you need to support combined characters, add your code to the method.

To use IME functions, your program must include IMM.H and link with IMM32.LIB.

Security noteSecurity Note

This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

To get samples and instructions for installing them:

To access samples from Visual Studio

  • On the Help menu, click Samples.

    By default, these samples are installed in drive:\Program Files\Microsoft Visual Studio 10.0\Samples\.

  • For the most recent version of this sample and a list of other samples, see Visual Studio Samples on the MSDN Web site.

Building and Running the Sample

To build and run this sample

  1. Open the solution IME.sln.

  2. From the Build menu, click Build.

  3. From the Debug menu, click Start Without Debugging.

Run the sample and try out the following features.

Control IME Mode

  • You can change IME mode using check boxes. If you change options using check boxes, the status of the IME window will be changed.

  • You can change IME mode using the IME window. If you change options using the IME window, check boxes in the sample will be changed.

  • You can enable or disable IME.

Implement IME Level 3

  • If you input double-byte characters, you can see how to composite strings.

  • If you have the proper font on Windows 2000, you can see surrogate characters.

Classes and Keywords

This sample demonstrates the following classes:

CEdit

This sample demonstrates the following keywords:

CBitmap::OnPaint; CEdit::OnChar; CEdit::OnSetFocus; CEdit::OnKillFocus; CEdit::OnKeyDown; CEdit::WindowProc; ImmGetContext; ImmReleaseContext; ImmGetConversionStatus; ImmSetConversionStatus; ImmGetOpenStatus; ImmSetOpenStatus; ImmAssociateContext; ImmNotifyIME; ImmGetCompositionString; ImmGetProperty; ImmSetCandidateWIndow; ImmSetCompositionWIndow

See Also

Other Resources

International Samples