EN
此内容没有您的语言版本,但有英语版本。

IOleObject::EnumVerbs method

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

Syntax


HRESULT EnumVerbs(
  [out]  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 IOleObject::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 value

This method returns S_OK on success. Other possible return values include the following.

Return codeDescription
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.

 

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.

The following table describes the members of the OLEVERB structure.

OLEVERB MemberDescription

iVerb

The verb number being enumerated. If the object supports OLEVERB_OPEN, OLEVERB_SHOW and/or OLEVERB_HIDE (or another predefined verb), these will be the first verbs enumerated, since they have the lowest verb numbers.

lpszVerbName

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.

 

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

OleIdl.h

IDL

OleIdl.Idl

IID

IID_IOleObject is defined as 00000112-0000-0000-C000-000000000046

See also

IOleObject
IOleObject::DoVerb
OleRegEnumVerbs

 

 

社区附加资源

添加
显示:
© 2014 Microsoft