MFC CMenu工具提示未显示

Nor*_*man 11 c++ windows mfc tooltip cmenu

我试图用这样的东西来设置的CMenu项的工具提示(如描述在这里),但它只是显示在一个单一的线和换行符是不可见的.

// read control id
UINT id = menu->GetMenuItemID(1235);
// modify caption and add tooltip?
menu->ModifyMenu( id, MF_BYCOMMAND, id, "Click here\nThis is the tooltip for the menu item ...");
Run Code Online (Sandbox Code Playgroud)

我还尝试直接在菜单项的visual studio资源设计器中设置标题,效果相同.你能给我任何关于什么错误的提示吗?我在Windows 7上使用VS2008.

任何帮助表示赞赏!

小智 1

也许您还没有将 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
Run Code Online (Sandbox Code Playgroud)