Click here to Skip to main content
15,887,337 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

What is the preferred way to add images to a standard Windows 7 menu in a MFC application (using VS2008)? The various API's for menus are really confusing, and everything about menus and commands in MFC applications seem to be about using dockable menu bars, instead of the standard HMENU wrapped in a CMenu, and for various reasons we can't use a dockable menu bar. Using a hbmpItem in calls to SetMenuItemInfo manually for each command works, but seems like inventing the wheel all over again.

Thanks

/M

[EDIT]:
Clarification: If we use a dockable menu bar such as CMFCMenuBar, the images for commands on toolbars are added automatically to the menu commands. For various reasons, we cannot use a docking menu bar, but are stuck with the standard Windows (non-MFC) HMENU-style menu. Now, there ought to be a smart way to add the images from the toolbars to the HMENU-style menus also, smarter than manually calling SetMenuItemInfo for each command.

(Yes, I've actually heard of this thing called Google. And, if you can't come up with anything better than "The answer is on the Internet", please refrain from responding.)
Posted
Updated 10-Jun-10 4:49am
v2

1 solution

Google this phrase, and sift through over 1.6 million hits (including at least one hit that references a thread here on CodeProject):

"c++ icons in menu"

I would derive a new class for CMenuItem, and handle the OnPaint method, but it's been three years since I've done any MFC, and they may have improved the library by now.
 
Share this answer
 
v2
Comments
Mattias G 10-Jun-10 10:09am    
Please ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900