tags:

views:

105

answers:

1

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

+1  A: 

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.
Prakash