Home > front end >  Develop Windows programs with Flutter, How to disable IME?
Develop Windows programs with Flutter, How to disable IME?

Time:09-27

I am using Flutter to develop a Windows program, Need to disable input method, Find the relevant documentation, you can use the ImmDisableIME(0) method to disable the input method. But when I try to call this method, An exception was reported when running the project.

main.cpp

win32_window.cpp

How to properly disable the input method?

CodePudding user response:

An exception was reported when running the project

No. An exception was not reported when running the project. Rather, your program never ran to begin with because it had a compiler error.

Because you are passing -1 to a function expecting an unsigned integer (DWORD), the compiler is warning you (C4245). And your build environment treats warnings as errors (C2220).

To invoke it with -1 such that it disables for all threads in the current process, then invoke it as follows with a cast. It's as easy as that.

DWORD dwParam = (DWORD)(-1);
ImmDisableIME(dwParam);
  • Related