共用方式為


IDirectMusicContainer8::EnumObject

The EnumObject method retrieves information about an object in the container.

Syntax

HRESULT EnumObject(
  REFGUID rguidClass, 
  DWORD dwIndex, 
  LPDMUS_OBJECTDESC pDesc,
  WCHAR* pwszAlias
);

Parameters

rguidClass

Reference to (C++) or address of (C) the unique identifier of the object class, or GUID_DirectMusicAllTypes to obtain an object of any type. For a list of standard loadable classes, see IDirectMusicLoader8.

dwIndex

Index of the object among objects of class rguidClass in the container.

pDesc

Pointer to a DMUS_OBJECTDESC structure that receives a description of the object. This parameter can be NULL if no description is wanted. (See Remarks.)

pwszAlias

Address of a string buffer of size MAX_PATH that receives the object's alias, if it has one. (An alias is a special name used by a script to refer to the object.) This parameter can be NULL if no alias is wanted.

Return Values

If the method succeeds, one of the following success codes is returned.

Return code Description
S_OK The object was enumerated.
S_FALSE There is no object with an index of dwIndex.
DMUS_S_STRING_TRUNCATED The alias is longer than MAX_PATH.
DMUS_S_GARBAGE_COLLECTED See Garbage Collection.

If the method fails, it can return E_POINTER.

Remarks

You must initialize the dwSize member of the DMUS_OBJECTDESC structure before passing it to the method. Other members are ignored. You cannot reduce the scope of the enumeration by, for example, specifying a value in the wszName member. The description returned by the method can be used to retrieve the object by calling IDirectMusicLoader8::GetObject. For sample code, see Containers.

Requirements

**  Header:** Dmusici.h
  Library: Dmloader.dll, Dmloaded.dll

See Also

© 2004 Microsoft Corporation. All rights reserved.