c++ - 无法通过 C++ 获取 IME 输入上下文 (ImmGetContext)

标签 c++ winapi ime

您好,我正在尝试使用以下伪代码禁用记事本上的 IME:

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());

上面的代码总是给我空上下文。 GetLastError() 给出 0;

有人可以告诉我如何获取InputContext

最佳答案

以防万一其他人遇到类似的问题

  • 除非您拥有窗口,否则您无法获取该窗口的输入上下文。
  • 因此您需要通过在该窗口进程中执行代码来调用 ImmGetInputContext(hwnd)。

关于c++ - 无法通过 C++ 获取 IME 输入上下文 (ImmGetContext),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2470591/

相关文章:

Android EditText 不起作用,android :imeOptions ="actionNext" android:inputType ="phone"

c++ - 从 Gtk::TreeStore 中删除图像的整洁方法

c++ - 如何使用不同的文件初始化具有重载构造函数的对象

c++ - 计算像素坐标 x 和 y

C++ 复制构造函数和赋值运算符定义

android - 如何在 InputMethodManager#hideSoftInputFromWindow 中使用 ResultReceiver

python - 收到 win32ui.error : CreateFile when trying to save a screenshot with python and winapi

c++ - RAII、unique_ptr 和输出参数

c++ - 在qt中使用窗口消息

c++ - MFC/WinAPI : How detect when system language changes in windows 10?