windows 禁用中文输入法(转)

源博客地址:http://blog.csdn.net/xie1xiao1jun/article/details/17913967

windows 程序禁用中文输入法方法:
1、添加windows头文件及dll文件

[cpp] view plain copy
 
  1. //输入法相关  
  2. #include <imm.h>  
  3. #pragma comment (lib ,"imm32.lib")  
  4. //---------------------------end  

2、禁用:

[cpp] view plain copy
 
  1. HIMC g_hIMC = NULL;//g_hIMC 用于恢复时使用  
  2. g_hIMC = ImmAssociateContext(handle, NULL);//handle 为要禁用的窗口句柄  


3、启用

[cpp] view plain copy
 
  1. ImmAssociateContext(handle, g_hIMC);//handle 为要启用的窗口句柄  

注意:如果是mfc程序,最好在InitInstance() 中加入 ImmDisableIME(GetCurrentThreadId());

 
1
原文地址:https://www.cnblogs.com/happinessday/p/6902730.html