IRichEditOleCallback::GetContextMenu method

Queries the application for a context menu to use on a right-click event.

Syntax

HRESULT GetContextMenu(
  WORD        seltype,
  LPOLEOBJECT lpoleobj,
  CHARRANGE   *lpchrg,
  HMENU       *lphmenu
);

Parameters

seltype

Type: WORD

Selection type. The value, which specifies the contents of the new selection, can be one or more of the following values.

Value Meaning
SEL_EMPTY
The selection is empty.
SEL_TEXT
Text.
SEL_OBJECT
At least one COM object.
SEL_MULTICHAR
More than one character of text.
SEL_MULTIOBJECT
More than one COM object.
GCM_RIGHTMOUSEDROP
Indicates that a context menu for a right-mouse drag drop should be generated. The lpoleobj parameter is a pointer to the IDataObject interface for the object being dropped.

lpoleobj

Type: LPOLEOBJECT

Pointer to an interface. If the seltype parameter includes the SEL_OBJECT flag, lpoleobj is a pointer to the IOleObject interface for the first selected COM object. If seltype includes the GCM_RIGHTMOUSEDROP flag, lpoleobj is a pointer to an IDataObject interface. Otherwise, lpoleobj is NULL. If you hold on to the interface pointer, you must call the AddRef method to increment the object's reference count.

lpchrg

Type: CHARRANGE*

Pointer to a CHARRANGE structure containing the current selection.

lphmenu

Type: HMENU*

The handle of a context menu to use. This parameter is ignored if an error is returned. A rich edit control destroys the menu when it is finished with it so the client should not.

Return Value

Type: HRESULT

Returns S_OK on success. If the method fails, it can be the following value.

Return code Description
E_INVALIDARG
There was an invalid argument.

Remarks

When the user selects an item from the context window, a WM_COMMAND message is sent to the parent window of the rich edit control.

Requirements

   
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header richole.h
DLL Msftedit.dll

See Also

CHARRANGE

GETCONTEXTMENUEX

IRichEditOleCallback

Reference