MFC CMenu tooltip not being displayed
I tried using something like this to set the to开发者_运维百科ol tip of a CMenu item (as described here) but it is just being displayed in a single line and the line break is not visible.
// 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 ...");
I also tried to set the caption directly in the visual studio resource designer of the menu item with the same effect. Can you give me any hints on whats wrong? I am using VS2008 on windows 7.
Any help is appreciated!
Perhaps you have not added the windows xp common controls to your application.
Try adding the common controls to your 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
Looks like an duplicate
Mainly you should use \r\n instead of \n because this is what mfc expects.
精彩评论