Date: | February 28, 2013 / year-entry #57 |
Tags: | code |
Orig Link: | https://blogs.msdn.microsoft.com/oldnewthing/20130228-00/?p=5113 |
Comments: | 4 |
Summary: | The MENUITEMINFO structure lets you specify a bitmap to appear next to the menu item. Is there a way to do this from a menu resource template? No. If you look at the format of menu templates, you'll see that there is nowhere to specify a bitmap. Which kind of makes sense, because it is... |
The No. If you look at the format of menu templates, you'll see that there is nowhere to specify a bitmap. Which kind of makes sense, because it is the responsibility of the application to destroy the bitmap referenced by the |
Comments (4)
Comments are closed. |
[Which kind of makes sense, because it is the responsibility of the application to destroy the bitmap referenced by the hbmpItem member when the menu is destroyed, but if you created the menu from a template, you don't know what that handle is, so you can't destroy it either!]
I'm sure there are cases where resource-created menus are destroyed, but I've not seen one yet.
[I discussed this nearly a decade ago. -Raymond]
That explains it. I've only ever used resource menus for RegisterWindowClass. When I create a popup menu, it's always dynamic from the current context so the only resource is the string resource (translation table [My translation tables aren't actually in the .rc but the concept is almost exactly the same]).
"I discussed this nearly a decade ago."
Ow, that hurt. I haven't been reading TONT since the beginning, but pretty close. Hard to believe it's been nearly a decade.
What hurts is using this byggy blogging software for decades.