Microsoft DirectX 8.1 (C++)

IDirectMusicScript8::EnumVariable

The EnumVariable method retrieves the name of a variable in a script. This method might be used by music-authoring applications that need to enumerate all variables in a script.

Syntax

HRESULT EnumVariable(
  DWORD dwIndex, 
  WCHAR *pwszName
);

Parameters

dwIndex

Zero-based index of the variable.

pwszName

Address of a string buffer that receives the name of the variable. Must contain at least MAX_PATH elements.

Return Values

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

Return code Description
S_OK The routine was enumerated.
S_FALSE There is no routine with the supplied index value.
DMUS_S_GARBAGE_COLLECTED See Garbage Collection.
DMUS_S_STRING_TRUNCATED The name is longer than MAX_PATH.

If the method fails, return values can include the following:

Return code
DMUS_E_NOT_INIT

Remarks

The following example, where pScript is a valid IDirectMusicScript8 interface pointer, displays the indexes and names of all variables in the script:

WCHAR wszVariableName[MAX_PATH];
int i = 0;
while (S_OK == pScript->EnumVariable(i++, wszVariableName))
  printf("Variable number %d is called %S\n", i, wszVariableName);

Requirements

  Header: Declared in dmusici.h.

See Also