IWMHeaderInfo::GetScript method

The GetScript method returns the type and command strings, and the presentation time, of a script.

Syntax

HRESULT GetScript(
  WORD  wIndex,
  WCHAR *pwszType,
  WORD  *pcchTypeLen,
  WCHAR *pwszCommand,
  WORD  *pcchCommandLen,
  QWORD *pcnsScriptTime
);

Parameters

wIndex

WORDthat contains the index.

pwszType

Pointer to a wide-character null-terminated string buffer into which the type is copied.

pcchTypeLen

On input, a pointer to a variable that contains the length of the pwszType array in wide characters (2 bytes). On output, if the method succeeds, the variable contains the actual length of the string loaded into pwszType.This includes the terminating null character. To retrieve the length of the type, you must set this to zero and set pwszType to NULL.

pwszCommand

Pointer to a wide-character null-terminated string buffer into which the command is copied.

pcchCommandLen

On input, a pointer to a variable that contains the length of the pwszCommand array in wide characters (2 bytes). On output, if the method succeeds, the variable contains the actual length of the command string. This includes the terminating null character. To retrieve the length of the command, you must set this to zero and set pwszCommand to NULL.

pcnsScriptTime

Pointer to a QWORDthat specifies the presentation time of this script command in 100-nanosecond increments.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK
The method succeeded.
ASF_E_BUFFERTOOSMALL
The size specified by pcchCommandLen or pcchTypeLen is not large enough to receive the value.
ASF_E_NOTFOUND
A script command that matches was not found.
NS_E_INVALID_STATE
The object is not in a configurable state.
E_INVALIDARG
A pointer is NULL where a value is required.
E_POINTER
A pointer variable does not contain a valid pointer.
E_UNEXPECTED
The method failed for an unspecified reason.

Remarks

You should make two calls to GetScript for each script you want to retrieve. On the first call, pass NULL for pwszType and pwszCommand. On return, the values that are pointed to by pcchTypeLen and pcchCommandLen are set to the number of wide characters. These include the terminating null character, which is required to hold the script type in pcchTypeLen and the command in pcchCommandLen. You can then create buffers of the appropriate size to receive pwszType and pwszCommand and pass pointers to them on the second call.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only],Windows Media Format 7 SDK, or later versions of the SDK
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wmsdkidl.h (include Wmsdk.h)
Library Wmvcore.lib; WMStubDRM.lib (if you use DRM)

See also

IWMHeaderInfo Interface

IWMHeaderInfo2

IWMHeaderInfo3

IWMHeaderInfo::AddScript

IWMHeaderInfo::GetScriptCount

IWMHeaderInfo::RemoveScript