Click here to Skip to main content
15,868,340 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In our application I tried to centralize all icon handling. Instead of adding icons to each toolbar and menu like this:
C++
button = new CMFCToolBarButton( commandId, imageIndex );

I added a central instace that tied each commandId to an icon, and the icons appear at the right places in the menus and toolbars.
C++
// Creating all buttons with icon index NULL
button = new CMFCToolBarButton( commandId, NULL, NULL, TRUE, FALSE );

// At another place adding all icons to commands in the Windows Command manager 
GetCmdMgr()->SetCmdImage( commandId, imageIndex, false );


My problem is that the toolbars are customizable, and if the user uses the customize function (the little down arrow on the toolbar) and selects Reset toolbar, all icons will be replaced by the NULL icon (the first registered with the SetCmdImage-command).

Can I somehow change the behaviour of the Reset toolbar-command, or change the registration of the icons so that they are considered default when resetting?

Regards,
Robert M
Posted

1 solution

To resolve this issue you better recreate the toolbar as new and fresh instance. The Microsoft implementation is somehow flawn.
 
Share this answer
 
Comments
RobertM 2-Sep-15 10:57am    
That was kind of tricky to do, but it seems to work!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900