views:

329

answers:

1

In a doc/view project using VS2008, a MFCMenuBar seems to load the correct MENU resource (IDR_MAINFRAME) from the project, since adding and removing menu items is reflected in the menu's UI. It even appends the accelerators to the default menu items (e.g. Ctrl+O to the Open... item). However, the accelerator table (IDR_MAINFRAME) doesn't seem to be connected to the menu. Changing the default Ctrl+O for Open... to something like Ctrl+7 doesn't work. The Ctrl+O is still appended to the Open... menu item, and Ctrl+O still invokes the Open... handler. There is only one accelerator table in the resource file, so I have no idea where the CMFCMenuBar is getting its accelerator information.

At this point, I've been able to get the accelerators to work by manually loading the IDR_MAINFRAME accelerator table and translating messages myself. But the CMFCMenuBar is still appending the default accelerators.

Can anyone explain what is going on here? How can I force the MFCMenuBar to utilize my accelerator table and either not append the accelerators or append the correct accelerators?

+2  A: 

Apparently some CMFCMenuBar settings are persisted to the registry (HKCU I think.) Try clearing your application's registry settings and see if the correct accelerators are shown.

See this MSDN thread for some related CMFCMenuBar troubleshooting.

Aidan Ryan
I had the same problem with a CDockablePane that did not use a recently updated accelerator table. Clearing HKCU\Software\<companyname>\<appname> solved the problem. I guess that the same thing would help for CMFCMenuBar.
fmunkert