共用方式為


IWMDRMReader::AcquireLicense 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.]

[AcquireLicense is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use Microsoft PlayReady. ]

The AcquireLicense method begins the license acquisition process.

Syntax

HRESULT AcquireLicense(
  [in] DWORD dwFlags
);

Parameters

[in] dwFlags

DWORD containing the relevant flags.

Flag Description
0x1 Indicates that the method will attempt to acquire the license silently.
0x0 Indicates that the OnStatus callback will return a URL to use on the Web to acquire a license.

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_OUTOFMEMORY
Not enough memory to complete the task.

Remarks

This is an asynchronous call that returns immediately.

For silent acquisition: When the license acquisition is complete, IWMStatusCallback::OnStatus is called with the status parameter set to WMT_ACQUIRE_LICENSE. If the license acquisition was successful, the pvalue parameter is set to a byte pointer to a WM_GET_LICENSE_DATA structure. If there was an error during the license acquisition, the HRESULT from the OnStatus call holds the appropriate error code.

For nonsilent acquisition: OnStatus will return immediately and send a WMT_ACQUIRE_LICENSE event to the application. In that case, the WM_GET_LICENSE_DATA structure contains information about the URL to be used to acquire the license.

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 WMStubDRM.lib

See also

Handling License Acquisition Events

IWMDRMReader Interface

IWMDRMReader::CancelLicenseAcquisition

WMT_STATUS