开发者

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

开发者 https://www.devze.com 2022-12-23 02:56 出处:网络
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

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 someb开发者_开发百科ody tell me how to get the InputContext


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

精彩评论

暂无评论...
验证码 换一张
取 消