我要在打开一个进程的时候关闭输入法,需要调用输入法设置函数如ImmDisableIME、ImmSetOpenStatus等(我已经包含了imm.h和imm32.lib),
但奇怪的是编译总是通不过,错误信息如下:error C2065: 'ImmDisableIME' : undeclared identifier

解决方案 »

  1.   

    在imm.h之上定义:
    #define _WIN32_WINNT 0x0500
    #include<imm.h>
    好运!
      

  2.   

    To jruv(江城飞鸿):
    还是同样的错误。--------------------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)
      

  3.   

    To jruv(江城飞鸿):
    还是同样的错误。--------------------Configuration: newIme - Win32 Debug--------------------
    Compiling...
    newImeDlg.cpp
    C:\test\newIme\newImeDlg.cpp(181) : error C2065: 'ImmDisableIME' : undeclared identifier
    Error executing cl.exe.
      

  4.   

    你的系统版本太低了,建议用2000 server以上
    只好手动修改头文件了
    进入<imm.h>,找到
    BOOL WINAPI ImmDisableIME(IN DWORD);将其上的#if (WINVER >= 0x040A)
    改为#if (WINVER >= 0x0300)
    或者干脆将这句及其相应的#endif 删掉。这样一定可以,试一下吧,注意改过后要Rebuild All
      

  5.   

    To jruv(江城飞鸿):
    我的系统为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)
      

  6.   

    Imm.h Windows.h.都要包含,还要联入库Imm32.lib.
      

  7.   

    To bluestar(蓝色星星):
    我在newImeDlg.cpp中加了Imm.h Windows.h,并加入库Imm32.lib,
    但还是出现同样的错误。
      

  8.   

    LPIMEMENUITEMINFOA
    LPIMEMENUITEMINFOW
    你用到这两种类型了吗?
      

  9.   

    如果你用到了的话
    在<imm.h>的这两种类型定义的地方有关#if
    的宏也要改啊,像上面一样。
      

  10.   

    可能是这个原因
    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