Microsoft DirectX 9.0

IDirectMusicScript8::SetVariableVariant

The SetVariableVariant method assigns a variant value to a variable declared in the script.

Syntax

HRESULT SetVariableVariant(
  WCHAR* pwszVariableName,
  VARIANT varValue, 
  BOOL fSetRef,
  DMUS_SCRIPT_ERRORINFO* pErrInfo
);

Parameters

pwszVariableName

Name of the script variable.

varValue

Value to assign to the variable.

fSetRef

TRUE if the variable is to be set by reference, FALSE if by value. Only objects can be set by reference. This flag should always be TRUE for DirectMusic objects and FALSE for other variants.

pErrInfo

Address of a DMUS_SCRIPT_ERRORINFO structure that receives information if an error occurs. Set this member to NULL if you do not want error information.

Return Values

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

Return code Description
S_OK The value was set.
S_FALSE The variable does not exist in the script.
DMUS_S_GARBAGE_COLLECTED See Garbage Collection.

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

Return code
DMUS_E_NOT_INIT
DMUS_E_SCRIPT_CONTENT_READONLY
DMUS_E_SCRIPT_NOT_A_REFERENCE
DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE
DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED
DMUS_E_SCRIPT_VARIABLE_NOT_FOUND
E_POINTER

Requirements

  Header: Declared in dmusici.h.

See Also