Tutorial :Not able to get IME Input Context through C++ (ImmGetContext)



Question:

Hi I am trying to disable the IME on notepad using the following psuedo code:

MakeNotepadActiveWindow();//Notepad is already open and set to Japanese IME    HWND hwnd = GetTheHWNDForNotepad();    HIMC context = ImmGetContext(hwnd);  if(context == NULL)  printf("context is null %d ",GetLastError());  

and the above code is always giving me the null context. GetLastError() gives 0;

Could somebody tell me how to get the InputContext


Solution:1

Just in case somebody else runs into similar problem

  • You can't get the input context for a window unless you own it.
  • So you need to call ImmGetInputContext(hwnd) by executing the code in that window's process.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »