我在一个Win32工程里面调用了函数GetMenuBarInfo
按MSDN的说法:Declared in Winuser.h, include Windows.h
可是我在编译的时候还是出错:error C2065: 'GetMenuBarInfo' : undeclared identifier
在函数前面加::会出另一个错:error C2039: 'GetMenuBarInfo' : is not a member of '`global namespace''这是怎么回事啊?? -_-~!

解决方案 »

  1.   

    在 #include "windows.h" 前面先
    #define WINVER 0x0500
      

  2.   

    #define WINVER 0x0500
    #include <windows.h>
      

  3.   

    谢谢,行了!顺便问下:MSDN上说能在win98下用,怎么#define WINVER 0x0400不行?
      

  4.   

    在 win98 下面能用,说明 win98 的 DLL 中导出了这个函数。
    GetMenuBarInfo 的函数原型只有在 WINVER 宏 >= 0x0500 时才定义。如果你不希望定义 #define WINVER 0x0500 宏,可以用 GetProcAddress() 的方法来使用。