SetMenuInfo 函数没有定义 怎么解决?

一亿光年 2013-03-01 10:24:39
SetMenuInfo 函数没有定义 怎么解决?
VC6.0环境
我想改变菜单的背景颜色;代码如下:
MENUINFO mi;
mi.cbSize=sizeof(MENUINFO);
mi.fMask=MIM_BACKGROUND;
mi.hbrBack=hBrush;
SetMenuInfo(hMenu,&mi);

错误如下:
error C2065: 'MENUINFO' : undeclared identifier
error C2065: 'mi' : undeclared identifier
error C2065: 'MIM_BACKGROUND' : undeclared identifier
error C2065: 'SetMenuInfo' : undeclared identifier

查了很多资料,说在#include <windows.h> 前加 #define WINVER 0x0501, 但是编译还是一样错误
求高手解决 !!!!
...全文
208 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
向立天 2013-04-19
  • 打赏
  • 举报
回复
您好 我是本版版主 此帖已多日无人关注 请您及时结帖 如您认为问题没有解决可按无满意结帖处理 另外本版设置了疑难问题汇总帖 并已在版面置顶 相关规定其帖子中有说明 您可以根据规定提交您帖子的链接 如您目前不想结帖只需回帖说明 我们会删除此结帖通知 见此回复三日内无回应 我们将强制结帖 相关规定详见界面界面版关于版主结帖工作的具体办法
schlafenhamster 2013-03-03
  • 打赏
  • 举报
回复
在 ‘winuser.h’ 中: typedef struct tagMENUINFO { DWORD cbSize; DWORD fMask; DWORD dwStyle; UINT cyMax; HBRUSH hbrBack; DWORD dwContextHelpID; DWORD dwMenuData; } MENUINFO, FAR *LPMENUINFO; typedef MENUINFO CONST FAR *LPCMENUINFO; #define MIM_MAXHEIGHT 0x00000001 #define MIM_BACKGROUND 0x00000002 #define MIM_HELPID 0x00000004 #define MIM_MENUDATA 0x00000008 #define MIM_STYLE 0x00000010 #define MIM_APPLYTOSUBMENUS 0x80000000 自己加 上面的 定义。 或者: // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #if !defined(AFX_STDAFX_H__31A230CF_F805_418F_8D90_51D3E98B66DB__INCLUDED_) #define AFX_STDAFX_H__31A230CF_F805_418F_8D90_51D3E98B66DB__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifndef WINVER // 允许使用 Windows 95 和 Windows NT 4 或更高版本的特定功能。 #define WINVER 0x0500 //为 Windows98 和 Windows 2000 及更新版本改变为适当的值。 #endif
一亿光年 2013-03-03
  • 打赏
  • 举报
回复
求高手解决 !!!!!!!!!!!!
孤客天涯 2013-03-01
  • 打赏
  • 举报
回复
stdafx.h文件中#define VC_EXTRALEAN前加上下面的 #undef WINVER #define WINVER 0X500
jimette 2013-03-01
  • 打赏
  • 举报
回复
#define WINVER 0x0501 把所有的0x0400 都改成0x0500以上!
一亿光年 2013-03-01
  • 打赏
  • 举报
回复
#ifndef WINVER #define WINVER 0x0501 #endif #ifndef _WIN32_WINDOWS #define _WIN32_WINDOWS 0x0501 #endif #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0501 #endif #ifndef _WIN32_IE #define _WIN32_IE 0x0600 #endif #include <windows.h> 加了这些在stdafx.h的头文件中 为什么还报错?
一亿光年 2013-03-01
  • 打赏
  • 举报
回复
引用 5 楼 sha_jinhao 的回复:
stdafx。h的头文件中!
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) #define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include <windows.h> //#define _WIN32_WINNT 0x0501 //#define WINVER 0x0501 // TODO: reference additional headers your program requires here //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) stdafx。h的头文件中! 是什么意思? 以上代码是我的stdafx。h的头文件
jimette 2013-03-01
  • 打赏
  • 举报
回复
stdafx。h的头文件中!
一亿光年 2013-03-01
  • 打赏
  • 举报
回复
引用 1 楼 sha_jinhao 的回复:
#define WINVER 0x0501 把所有的0x0400 都改成0x0500以上!
请问所有的是哪些? 谢谢!
一亿光年 2013-03-01
  • 打赏
  • 举报
回复
引用 楼主 wbywubangyun 的回复:
SetMenuInfo 函数没有定义 怎么解决? VC6.0环境 我想改变菜单的背景颜色;代码如下: MENUINFO mi; mi.cbSize=sizeof(MENUINFO); mi.fMask=MIM_BACKGROUND; mi.hbrBack=hBrush; SetMenuInfo(hMenu,&mi); 错误如下: error C2065: 'MENU……
请问所有的是哪些?

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧