Tool Context Menus

To customize the context menu that displays in the Tool Palettes window's background, you implement the IAcadToolContextMenu interface. The framework queries your IAcadStockTool COM object for this interface. When a user right-clicks on the Tool Palettes window's background, the framework calls the IAcadToolContextMenu::Customize() method on each stock tool that returns a valid interface pointer.

The Customize() method is simple to implement. The framework passes Customize() the handle of the current context menu, as well as the ID of the tool palette on which it is displayed. If the tool palette's ID references one of your palettes, you may either customize the context menu, hide it, or do nothing. If you customize the menu, you use MFC or other means to access the menu from its handle. You then can add your own items to the menu, or remove standard items. The framework also passes you the minimum and maximum values that define the ID range you may use when adding items.

When the user selects a menu command defined by your stock tool, the framework calls your IAcadToolContextMenu::InvokeMenuCommand() implementation for execution.