Windows Media Player 11 SDK IWMPSubscriptionService2::prepareForSync 

Windows Media Player SDK banner art

Previous Next

IWMPSubscriptionService2::prepareForSync

Note This section describes functionality designed for use by online stores. Use of this functionality outside the context of an online store is not supported.

The prepareForSync method is implemented by the online store and called by Windows Media Player just before synchronization happens. Use this method to perform tasks related to synchronizing a digital media file to a device.

Syntax

  HRESULT prepareForSync(
  BSTR  bstrFilename,
  BSTR  bstrDeviceName,
  IWMPSubscriptionServiceCallback*  pCB
);

Parameters

bstrFilename

String containing the name of the digital media file being synchronized.

bstrDeviceName

String containing the canonical name of the device.

pCB

Pointer to an IWMPSubscriptionServiceCallback interface. The online store uses this pointer to notify Windows Media Player that preparation for synchronization is complete.

Return Values

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.

Remarks

Your code should not perform lengthy operations synchronously when Windows Media Player calls this method. Instead, you must perform device-specific processing tasks on a separate worker thread.

The string contained in bstrDeviceName is not the same name retrieved using IWMPSyncDevice::deviceName. Rather, it is the canonical name retrieved by using the IWMDMDevice2::GetCanonicalName method provided by the Windows Media Device Manager SDK.

When you use pCB to call IWMPSubscriptionServiceCallback::onComplete, you should return a success code to allow Windows Media Player to continue synchronizing the specified digital media file, or an error code to disallow synchronization. Windows Media Player displays an error message based on the error code you provide. You should avoid using generic HRESULTs, such as E_FAIL. Instead, you can return the HRESULT error code you receive from a call to one of the Windows Media SDKs, such as the Windows Media Device Manager SDK, or one of the error codes in nserror.h, which can be found in the \Include folder where you installed the Windows Media Player SDK.

You must call onComplete from same thread on which prepareForSync was called.

Requirements

Version: Windows Media Player 10 or later.

Header: Defined in subscriptionservices.h.

See Also

Previous Next