This document is archived and information here might be outdated.  Recommended version.


IToolbarMenu.SetHook Method (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Controls)  

IToolbarMenu.SetHook Method

Sets the object that is passed as a hook to the OnCreate event of each item's command.

[Visual Basic .NET]
Public Sub SetHook ( _
    ByVal pHook As Object _
)
[C#]
public void SetHook (
    object pHook
);
[C++]
HRESULT SetHook(
  IDispatch* pHook
);
[C++]

Parameters pHook [in] pHook is a parameter of type IDispatch*

Product Availability

Available with ArcGIS Engine.

Description

The Hook is a shortcut to ICommandPoolEdit::Hook on the CommandPool. If the ToolbarMenu is an item on the ToolbarControl the Hook is shared and initialized by the ToolbarControl. If the ToolbarMenu is a standalone popup menu use the SetHook method, and optionally share the CommandPool with an existing one within the application.

See Also

IToolbarMenu Interface

.NET Snippets

Create PopUp ToolbarMenu

.NET Samples

Creating toolbar menus that work with the ToolbarControl (Code Files: ToolbarMenu) | ArcGIS Network Analyst extension Engine application (Code Files: frmMain) | Displaying a TOCControl context menu (Code Files: TOCContextMenuForm) | Using HookActions in custom commands (Code Files: HookActions) | Building a MapViewer application using the ArcGIS Engine controls (Code Files: MapViewer) | Implementing a property page for an ArcGIS Engine application (Code Files: TocContextMenuClass) | Save a layer file in a MapControl application (Code Files: ContextMenuClass) | Schematics Engine application (Code Files: MainForm)