Compartilhar via


IWMHeaderInfo::GetScript method (wmsdkidl.h)

[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

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

Syntax

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

Parameters

[in] wIndex

WORD that contains the index.

[out] pwszType

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

[in, out] 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.

[out] pwszCommand

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

[in, out] 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.

[out] pcnsScriptTime

Pointer to a QWORD that 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

Requirement Value
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