Implementing Tooltips for Menus | CodeGuru

Implementing Tooltips for Menus

Environment: VC6, NT4 SP3 Well, as you see the new Win2000 you may have wondered how to get those nice tool tips for menu bars in your own apps. Then you found the right place ! In my small demo application I implemented a very simple tooltip for menus which uses the status bar messages […]

Written By
CodeGuru Staff
CodeGuru Staff
Apr 27, 2000
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Environment: VC6, NT4 SP3

Well, as you see the new Win2000 you may have wondered how to
get those nice tool tips for menu bars in your own apps. Then you
found the right place !

In my small demo application I implemented a very simple
tooltip for menus which uses the status bar messages for its own
display (informative though)

My implementation is probably quite preliminary, but it seems
to work with NT 4.0, Win 98 and maybe Win 95, too.

All the changes to get the menu tip go to CMainFrame class. I
first overrode both OnEnterMenuLoop and OnExitMenuLoop,
furthermore OnEnterIdle and then FilterToolTipMessage. When a
menu pops up, OnEnterMenuLoop is called, which then creates a
WS_EX_TOPMOST style tooltip. The tooltip is updated by
OnEnterIdle which passes fake WM_MOUSEMOVE messages to the
tooltip using RelayEvent. I do need to override
FilterToolTipMessage, because the MFC CWnd::FilterToolTipMessage
does not create WS_EX_TOPMOST tooltips and therefore does NOT
display the tooltip. It is important to define your own method !

Well, that4s it, I think. Just download the sample app and
try it !

Downloads

Download demo project – 32 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.