没有显示MFC CMenu工具提示

MFC CMenu tooltip not being displayed

本文关键字:CMenu 工具提示 MFC 显示      更新时间:2023-10-16

我尝试使用这样的东西来设置CMenu项的工具提示(如这里所述),但它只是显示在单行中,换行符不可见。

// read control id
UINT id = menu->GetMenuItemID(1235);
// modify caption and add tooltip?
menu->ModifyMenu( id, MF_BYCOMMAND, id, "Click herenThis is the tooltip for the menu item ...");

我还尝试在菜单项的visual studio资源设计器中直接设置标题,效果相同。你能给我提示一下什么地方不对吗?我在windows 7上使用VS2008。

任何帮助都是感激的!

也许您还没有在您的应用程序中添加windows xp常用控件。

尝试将常用控件添加到stdafx.h:

#ifdef UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'"")
#else
#pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"")
#endif
#endif

看起来像一个副本

主要是你应该使用rn而不是n,因为这是mfc期望的。