This documentation is archived and is not being maintained.

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

Download sample

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 provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

Building and Running the Sample

NoteNote

If you are running Visual C++ Express Edition, you might need to install the Platform SDK before running this sample. For information on how to do this, see How to: Use Visual C++ Express Edition with the Microsoft Platform SDK.

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

Show: