Customization Filter Extension

Created:11/01/1999
Description:

The Customization Filter Example shows how to create a custom ArcMap Extension that uses a Customization Filter to lock some of the customization functionality in ArcMap. The lock that is set by this extension will override any other locking logic that might be saved in an existing ArcMap document. Since the extension is loaded when the ArcMap application is started, the extension locks customization before any documents are loaded in ArcMap. This lock does the following 3 things:
  1. Prevents the Visual Basic Editor from being opened.
  2. Locks the Map and Edit categories. These categories will not appear in the Categories list on the Commands panel of the Customize dialog. This prevents users from dragging the commands in these categories onto toolbars.
  3. Locks the What's This Help command. This command will not show up in the Commands list for the Help category on the Commands panel of the Customize dialog. This prevents users from dragging this command onto a toolbar but still gives them access to the other commands in the Help category.
The class for MyFilter implements the ICustomizationFilter interface. A CustomizationFilter provides a mechanism to lock parts of the customization functionality in ArcMap. The ICustomizationFilter interface has an OnCustomizationEvent event that gets fired whenever a user attempts any type of customization. There are six types of customization events that can happen. These are defined by the esriCustomizationEvent constants. For each type of customization event there is an event context. Refer to the list below to see what type of information is provided by the event context, eventCtx.
custEventTypeeventCtx
esriCEAddCategorystring representing category name
esriCEAddCommandUID or string identifying a command
esriCEShowCustDlgnothing
esriCEShowVBAIDEnothing
esriCEInvokeCommandCommandItem
esriCEShowCustCtxMenunothing
This example will use esriCEAddCategory, esriCEAddCommand, and esriCEShowVBAIDE.

The class for FiltExt implements the IExtension interface. An extension automatically gets loaded when the application is started. The IExtension interface sets the name of the extension and defines the action that occurs when the extension is started and shut down. The StartUp event of the FiltExt extension starts listening for the MxDocument events. The lock gets set on the MxDocument OpenDocument and NewDocument events.


How to use:
  1. Register the dll on your machine.
  2. Use Categories to add the dll to the 'ESRI Mx Extensions' component category.
  3. Start ArcMap and check to see that some customization functionality is locked. You should not be able to open the Visual Basic Editor. Open the Customize dialog. On the Commands panel, Edit and Map should not show up in the Categories list. Select the Help category. The What's This Help command should not be in the Commands list for the Help category.

Application:
ArcMap

Difficulty: Intermediate


Visual Basic
File Description
MyFilter.cls Class file demonstrating how to create a custom cutomization filter.
FiltExt.cls Class file demonstrating how to create a custom extension.
CustFilter.vbp The project file for the custom extension and customization filter.
CustFilter.dll The compiled project.


Key Interfaces: ICustomizationFilter, IExtension