IWMPSubscriptionService2::prepareForSync method (subscriptionservices.h)
[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
Syntax
HRESULT prepareForSync(
[in] BSTR bstrFilename,
[in] BSTR bstrDeviceName,
[in] IWMPSubscriptionServiceCallback *pCB
);
Parameters
[in] bstrFilename
String containing the name of the digital media file being synchronized.
[in] bstrDeviceName
String containing the canonical name of the device.
[in] pCB
Pointer to an IWMPSubscriptionServiceCallback interface. The online store uses this pointer to notify Windows Media Player that preparation for synchronization is complete.
Return value
The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
Return code | Description |
---|---|
|
The method succeeded. |
Remarks
The string contained in bstrDeviceName is not the same name retrieved using IWMPSyncDevice::get_deviceName. Rather, it is the canonical name retrieved by using the IWMDMDevice2::GetCanonicalName method provided by the Windows Media Device Manager SDK.
Your code should not perform lengthy operations synchronously when Windows Media Player calls this method. Instead, you must perform time-consuming tasks on a separate worker thread. When the worker thread has completed its work, it must call IWMPSubscriptionServiceCallback::onComplete.
Use the following procedure to provide your worker thread with a pointer to an IWMPSubscriptionServiceCallback interface.
- Pass pCB to CoMarshalInterThreadInterfaceInStream, which returns an IStream pointer.
- Pass the IStream pointer to your worker thread.
- In your worker thread, call CoGetInterfaceAndReleaseStream, which returns an interface pointer that you can use to call onComplete.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Media Player 10 or later. |
Target Platform | Windows |
Header | subscriptionservices.h |