This documentation is archived and is not being maintained.


The framework calls this function as part of the processing of IRichEditOleCallback::GetContextMenu.

virtual HMENU GetContextMenu(
   WORD seltyp,
   LPOLEOBJECT lpoleobj,
   CHARRANGE* lpchrg 


The selection type. The selection type values are described in the Remarks section.


Pointer to a OLEOBJECT structure specifying the first selected OLE object if the selection contains one or more OLE items. If the selection contains no items, lpoleobj is NULL. The OLEOBJECT structure holds a pointer to an OLE object v-table.


Pointer to a CHARRANGE structure containing the current selection.

Handle to the context menu.

This function is a typical part of right mouse-button down processing.

The selection type can be any combination of the following flags:

  • SEL_EMPTY   Indicates that there is no current selection.

  • SEL_TEXT   Indicates that the current selection contains text.

  • SEL_OBJECT   Indicates that the current selection contains at least one OLE item.

  • SEL_MULTICHAR   Indicates that the current selection contains more than one character of text.

  • SEL_MULTIOBJECT   Indicates that the current selection contains more than one OLE object.

The default implementation returns NULL. This is an advanced overridable.

For more information, see IRichEditOleCallback::GetContextMenu and CHARRANGE in the Windows SDK.

For more information on the OLEOBJECT type, see the OLE Data Structures and Structure Allocation article in the OLE Knowledge Base.

Header: afxrich.h