Share via


Windows Media Player 11 SDK Ripping by Using IWMPPlayerServices::setTaskPane 

Windows Media Player SDK banner art

Previous Next

Ripping by Using IWMPPlayerServices::setTaskPane

Note This section documents a feature of the Windows Media Player 9 Series and Windows Media Player 10 ActiveX controls. It is recommended that you use the IWMPCdromRip interface with later versions. See IWMPCdromRip Interface.

You can use the Windows Media Player 9 Series or later control to copy CD tracks to the user's computer. This process is called ripping. To do this, you must embed the Windows Media Player control in remote mode. For more information about remote mode, see Remoting the Windows Media Player Control.

To start the ripping process, call IWMPPlayerServices::setTaskPane, passing the CopyFromCD?AutoCopy:id value for the bstrTaskPane parameter, where id is the index of the CD drive from which to copy. This index corresponds to the index of a Cdrom object in the IWMPCdromCollection interface or the CdromMediaChange event.

The following example code is a function that starts the process of ripping a CD from the CD drive identified by index zero. The function uses the following member variable:

  

The following code shows the body of the function:

  

Displaying Status to the User

When copying from a CD, you can retrieve a string containing status information about the copy operation. To do this, you must first retrieve a playlist containing media items that represent the CD tracks by calling IWMPCdrom::get_playlist. Like the previous example, the following example code works with CD drive index zero. It stores the retrieved playlist in the following member variable:

  

The following code shows the body of the function:

  

Next, handle the IWMPEvents::MediaChange event. This event occurs when a CD track is being ripped. The IDispatch pointer passed to the event handler points to the IWMPMedia interface for the CD track. Call QueryInterface through IDispatch to retrieve the pointer to IWMPMedia.

To detect which CD track is being ripped, compare the IWMPMedia pointer from the event to the media items in the CD playlist by calling IWMPMedia::get_isIdentical.

Call IWMPMedia::getItemInfo, passing the string "Status" as the item name. Status is a temporary attribute set by Windows Media Player on media items while they are being ripped from CD; it is not available from the library.

The following example code shows a MediaChange event handler.

  

See Also

Previous Next