我要在打开一个进程的时候关闭输入法,需要调用输入法设置函数如ImmDisableIME、ImmSetOpenStatus等(我已经包含了imm.h和imm32.lib),
但奇怪的是编译总是通不过,错误信息如下:error C2065: 'ImmDisableIME' : undeclared identifier
但奇怪的是编译总是通不过,错误信息如下:error C2065: 'ImmDisableIME' : undeclared identifier
#define _WIN32_WINNT 0x0500
#include<imm.h>
好运!
还是同样的错误。--------------------Configuration: newIme - Win32 Debug--------------------
Compiling...
newImeDlg.cpp
C:\test\newIme\newImeDlg.cpp(181) : error C2065: 'ImmDisableIME' : undeclared identifier
Error executing cl.exe.newIme.exe - 1 error(s), 0 warning(s)
还是同样的错误。--------------------Configuration: newIme - Win32 Debug--------------------
Compiling...
newImeDlg.cpp
C:\test\newIme\newImeDlg.cpp(181) : error C2065: 'ImmDisableIME' : undeclared identifier
Error executing cl.exe.
只好手动修改头文件了
进入<imm.h>,找到
BOOL WINAPI ImmDisableIME(IN DWORD);将其上的#if (WINVER >= 0x040A)
改为#if (WINVER >= 0x0300)
或者干脆将这句及其相应的#endif 删掉。这样一定可以,试一下吧,注意改过后要Rebuild All
我的系统为winXP,应该不会是版本低的问题,着你的改后编译时还是报如下错误:Deleting intermediate files and output files for project 'newIme - Win32 Debug'.
--------------------Configuration: newIme - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
newIme.cpp
newImeDlg.cpp
e:\microsoft visual studio\vc98\include\imm.h(343) : error C2061: syntax error : identifier 'LPIMEMENUITEMINFOA'
e:\microsoft visual studio\vc98\include\imm.h(344) : error C2061: syntax error : identifier 'LPIMEMENUITEMINFOW'
Generating Code...
Error executing cl.exe.newIme.exe - 2 error(s), 0 warning(s)
我在newImeDlg.cpp中加了Imm.h Windows.h,并加入库Imm32.lib,
但还是出现同样的错误。
LPIMEMENUITEMINFOW
你用到这两种类型了吗?
在<imm.h>的这两种类型定义的地方有关#if
的宏也要改啊,像上面一样。
MSDN中提到:The application must call this function before the first top-level window in the thread receives theWM_CREATE message. This means the application must call this function in one of the following places: Any time before callingCreateWindow to create the first top-level window
In the first top-level window'sWM_NCCREATE handler