次の方法で共有


IWMMutualExclusion2::GetRecordName 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 GetRecordName method retrieves the name of the specified record. A record has a name only if a name has been assigned using the IWMMutualExclusion2::SetRecordName method.

Syntax

HRESULT GetRecordName(
  [in]      WORD  wRecordNumber,
  [out]     WCHAR *pwszRecordName,
  [in, out] WORD  *pcchRecordName
);

Parameters

[in] wRecordNumber

WORD containing the number of the record for which you want to get the name.

[out] pwszRecordName

Pointer to a wide-character null-terminated string containing the record name. Pass NULL to retrieve the length of the name.

[in, out] pcchRecordName

On input, a pointer to a variable containing the length of the pwszRecordName array in wide characters (2 bytes). On output, if the method succeeds, the variable contains the length of the name, including the terminating null character. However, if you pass NULL as pwszRecordName, this will be set to the required length on output.

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.
E_INVALIDARG
wRecordNumber does not contain a valid record number.

OR

pcchRecordName is NULL.

E_FAIL
The method is unable to access the record for an unspecified reason.

Remarks

You should make two calls to GetRecordName for each record name you want to retrieve. On the first call, pass NULL as pwszRecordName. On return, the value pointed to by pcchRecordName will be set to the number of wide characters, including the terminating null character, required to hold the record name. Then you can allocate the required amount of memory for the string and pass a pointer to it as pwszRecordName on the second call.

Records are assigned numbers sequentially in the order they are created.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only],Windows Media Format 9 Series 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

IWMMutualExclusion2 Interface