Compartilhar via


IOleObject::EnumVerbs

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

HRESULT EnumVerbs( 
  IEnumOleVerb** ppEnumOleVerb
);

Parameters

  • 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 IUnknown::Release when it is done with *ppEnumOleVerb. If an error occurs, *ppEnumOleVerb must be set to NULL.

Return Values

One of the values described in the following table is returned.

Value Description
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

To determine whether the platform supports this interface, see Determining Supported COM APIs.

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 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 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 follows.

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

The following list describes the members of the OLEVERB structure:

  • 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, because they have the lowest verb numbers.

  • lpszVerbName
    Long pointer to the null-terminated string that contains the 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, and 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.

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Oleidl.h, Oleidl.idl.
Link Library: Oleaut32.lib, Uuid.lib.

See Also

IOleObject | AppendMenu | Determining Supported COM APIs | IUnknown::Release | OLEVERB | OLEVERBATTRIB

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.