Home Dashboard Directory Help

Incomplete documentation for CMFCColorButton class by DD Blue Ox


 as Fixed Help for as Fixed

Sign in
to vote
Type: Suggestion
ID: 600357
Opened: 9/17/2010 8:44:23 AM
Access Restriction: Public


What the documentation for CMFCColorButton neglects to mention is that if you follow the directions in the documentation, the "other" button won't work except for system colors (and then the second parameter of the EnableOtherButton method must be FALSE). To give the "other" button its full functionality you need to add the following to your .rc2 resource file:

#ifndef _AFXDLL
#include "afxribbon.rc" // Ribbon and control bars.

Leave at least one blank line after this code so the compiler doesn't complain. You can't add this include statement to the .rc file because Visual Studio would overwrite it the next time you make a change to any resource. Visual Studio doesn't edit the .rc2 file so it's safe there.

This addition is necessary even if you add a CMFCColorButton in the VS2010 designer. The designer SHOULD add the code to the .rc file but it doesn't do so. This appears to be a bug in the way that control has been configured in the designer.

Dennis Dykstra
Sign in to post a comment.
Posted by Microsoft on 9/22/2010 at 10:35 AM
Hello Dennis,

Thanks for the report. This issue has already been fixed in the MFC application wizard for the next major release of Visual Studio.

Your workaround is one way to fix the issue. The other is to add the #include of afxribbon.rc to the project RC file (right near the same location where afxres.rc is included). This is the fix I made to the wizard-generated code. Note that the additional resources are only necessary when MFC is used from a static library--then you need the resources in your executable. If MFC is used from a DLL, then the resources are found in the DLL and do not need to be included in your EXE.

Pat Brenner
Visual C++ Libraries Development
Posted by Microsoft on 9/17/2010 at 5:09 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.