IContextMenu2 

The IContextMenu2 interface is used to either create or merge a context menu associated with a certain object when a client of IContextMenuGAKT5J is supposed to handle messages associated with owner-drawn menu items.

When to Implement

Implement IContexMenu2 if your object is a client of IContextMenu when owner-drawn messages are an issue: Do so if it is possible to receive one of the following messages while calling TrackPopupMenu in the window procedure of the menu s owner window:

WM_INITPOPUP

WM_DRAWITEM

WM_MEASUREITEM

 

These messages are sent only if a QueryInterface2Y54585 call for an IContextMenu2 interface pointer is successful, indicating that the object supports this interface.

When to Use

You do not call this interface directly. IContextMenu2 is used by the operating system only when it has confirmed that the application is aware of this interface.

Methods in Vtable Order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef1SHW0SS

Increments reference count.

ReleaseDUW01A

Decrements reference count.

 

IContextMenu2 Methods

Description

QueryContextMenu25TEIJ

Adds commands to a context menu.

HandleMenuMsg17HMXYC

Handles messages related to drawing owner-drawn menu items.

InvokeCommand119KGXK

Carries out a menu command, either in response to user input or otherwise. For an example, see IExtractIcon5338SX.

GetCommandString.MIOJD

Retrieves the language-independent name of a menu command or the help text for a menu command.