IOleObject::EnumVerbs

Exposes a pull-down menu listing the verbs available for an object in ascending order by verb number.

HRESULT EnumVerbs(
  IEnumOleVerb **ppEnumOleVerb  //Address of output variable that 
                                // receives the IEnumOleVerb interface 
                                // pointer
);
 

Parameter

ppEnumOleVerb
[out] Address of IEnumOleVerb* pointer variable that receives the interface pointer to the new enumerator object. Each time an object receives a call to EnumVerbs, it must increase the reference count on *ppEnumOleVerb. It is the caller's responsibility to call Release when it is done with *ppEnumOleVerb. If an error occurs, *ppEnumOleVerb must be set to NULL.

Return Values

S_OK
Verb(s) enumerated successfully.
OLE_S_USEREG
Delegate to the default handler to use the entries in the registry to provide the enumeration.
OLEOBJ_E_NOVERBS
Object does not support any verbs.

Remarks

Notes to Callers

Containers call this method to expose a pull-down menu of the verbs available for their embedded objects. You may want your container to call IOleObject::EnumVerbs each and every time such a menu is selected in order to enable such objects as media clips, whose verbs may change while they are running, to update their menus. The default verb for a media clip, for example, changes from "Play" before it is activated to "Stop" once it is running.

Notes to Implementers

The default handler's implementation of IOleObject::EnumVerbs uses the registry to enumerate an object's verbs. If an object application is to use the default handler's implementation, it should return OLE_S_USEREG.

The enumeration returned is of type IEnumOLEVERB:

typedef Enum < OLEVERB > IEnumOLEVERB; 
 

where OLEVERB is defined as:

typedef struct tagOLEVERB 
{ 
    LONG    iVerb; 
    LPOLESTR   lpszVerbName; 
    DWORD   fuFlags; 
    DWORD   grfAttribs; 
} OLEVERB; 
 

The following table describes the members of the OLEVERB structure:

OLEVERB Member Description
iVerb Verb number being enumerated. If the object supports OLEIVERB_OPEN, OLEIVERB_SHOW and/or OLEIVERB_HIDE (or another predefined verb), these will be the first verbs enumerated, since they have the lowest verb numbers.
lpszVerbName Name of the verb.

In Windows, this value, along with optional embedded ampersand characters to indicate accelerator keys, can be passed to the AppendMenu function.

On the Macintosh, the following metacharacters may be passed along with this value:

· ! marks the menu item with the subsequent character
· < sets the character style of the item
· ( disables the item.
The metacharacters / and ^ are not permitted.
fuFlags In Windows, a group of flags taken from the flag constants beginning with MF_ defined in AppendMenu. Containers should use these flags in building an object's verb menu. All Flags defined in AppendMenu are supported except for:
· MF_BITMAP
· MF_OWNERDRAW
· MF_POPUP
grfAttribs In Windows, a group of flag bits taken from the enumeration OLEVERBATTRIB. The flag OLEVERBATTRIB_NEVERDIRTIES indicates that executing this verb will not cause the object to become dirty and is therefore in need of saving to persistent storage.

OLEVERBATTRIB_ONCONTAINERMENU indicates that this verb should be placed on the container's menu of object verbs when the object is selected. OLEIVERB_HIDE, OLEIVERB_SHOW, and OLEIVERB_OPEN never have this value set.


For more information on the Windows AppendMenu function, see the Microsoft Win32 SDK.

QuickInfo

  Windows NT: Use version 3.1 or later.
  Windows: Use Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in oleidl.h.

See Also

IOleObject::DoVerb, OleRegEnumVerbs