You are currently offline, waiting for your Internet to reconnect

How to disable IME for a particular window

This article was previously published under Q171154
Support for the following product versions has been discontinued. For more information about product retirement, visit the following Microsoft Web site: Refer the customer to online resources such as the Microsoft Knowledge Base, Frequently Asked Questions, and Newsgroups at the following Microsoft Web site: In the East Asian versions of Windows 95 and Windows NT 4.0, applications cancall ImmAssociateContext() to disable IME for a certain window. Windows 95and Windows 4.0 now have a new East Asian Common API Specification thatenables this to would work for the Chinese, Japanese, and Korean versionsof Windows 95 and Windows NT 4.0.

Sample code

To disable IME for a certain window, an application can callImmAssociateContext() API as shown below:
      HIMC hIMC;   hIMC = ImmAssociateContext(hWnd, NULL);   // It makes IME disable for                                             // hWnd window.   // Then you can do whatever you want without IME.   ImmAssociateContext(hWnd, hIMC); // If you want to enable                                    // IME again, then you can                                    // use the previous stored IME                                    // context(hIMC)                                    // to restore IME.				
This method will not work on Windows 3.1 and Windows NT 3.5. You can useWinnlsEnableIME()for these systems, but this function will enable/disablethe whole system IME, not just for a specific window.

The reason ImmAssociateContext() does not work on Windows NT 3.51 is thatwhen Microsoft was developing new IMM functions, Windows NT 3.51 wasalready released with old functionality. Windows NT 3.5 and 3.51 still useWindows 3.1 style IME API like WinnlsEnableIME and SendIMEMessageEx. But,Windows NT 4.0 adapted Windows 95's IME API so that Windows NT 4.0 has thesame set of IME API with Windows 95.

Article ID: 171154 - Last Review: 11/21/2006 15:44:00 - Revision: 4.1

Microsoft Win32 Application Programming Interface

  • kbhowto kbintldev kbcode kbusage KB171154