Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.


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

Community Additions

© 2015 Microsoft