I ran into this issue when trying to add a CMFCMenuButton to an existing MFC application. It worked properly, and even resized the button to accommodate the dropdown arrow. But it didn't draw the dropdown arrow, and when I hovered over the button, I saw the following debug output:
> Can't load bitmap: 42b8.GetLastError() = 716
> CMenuImages. Can't load menu images 3f01
It turns out that even with Visual Studio 2010 RTM, when you create a brand new MFC Dialog based application, the CMFCMenuButton doesn't draw the arrow and shows the same errors. Initially I assumed that I didn't have something installed or registered correctly. However, the NewControls example from the MFC Feature Pack showed the dropdown arrow perfectly.
What is missing?
I solve this problem for myself in such way: I add a clause to
CMyApp::InitInstance
:The reason I posted this question is because I couldn't find any answers via Google. The closest I came when researching it was a couple hacks that didn't seem to be the real solution. After pouring over the NewControls example, I finally found the culprit.
At the bottom of the default .rc file for a project, there is the following code:
The NewControls example's .rc file looks like this:
Adding the afxribbon.rc enables the bitmap resources needed for the controls in the MFC Feature pack update. Now you can't just simply add the missing code to the bottom of the .rc file. If you do that, every time you edit the resource file using the visual designer, your added code will be removed. The solution to the problem is to add this to the bottom of the YOUR_PROJECT_NAME.rc2 file:
Make sure you have an empty line at the bottom of the file, or the resource compiler will complain. I'm not sure what setting needs to be adjusted in order for the visual designer to automatically include afxribbon.rc like it does in the NewControls example project. But adding it to the .rc2 seems to fix the problem.
Update
Keep in mind that you can use the IDE to modify your RC file: