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
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:
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE 9, 1 #include "res\YOUR_PROJECT_NAME.rc2" // non-Microsoft Visual C++ edited resources #include "afxres.rc" // Standard components #endif
The NewControls example's .rc file looks like this:
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE 9, 1 #include "res\NewControls.rc2" // non-Microsoft Visual C++ edited resources #include "afxres.rc" // Standard components #ifndef _AFXDLL #include "afxribbon.rc" // Ribbon and control bars #endif #endif
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:
#ifndef _AFXDLL #include "afxribbon.rc" // Ribbon and control bars #endif
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.