Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MFC CMenu tooltip not being displayed

I tried using something like this to set the tool 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!

like image 640
Norman Avatar asked Jul 07 '11 12:07

Norman


2 Answers

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
like image 115
Tom Chakam Avatar answered Oct 20 '22 08:10

Tom Chakam


Looks like an duplicate

Mainly you should use \r\n instead of \n because this is what mfc expects.

like image 23
Totonga Avatar answered Oct 20 '22 07:10

Totonga