CDINFO Sample: Plays and Displays Information About CD Audio Tracks
The document is archived and information here might be outdated

CDINFO Sample: Plays and Displays Information About CD Audio Tracks

Visual Studio .NET 2003

The CDINFO sample uses the Media Control Interface (MCI) APIs to retrieve the length of the audio tracks on the CD currently in your CD-ROM drive. CDINFO then draws a piechart to display track length. CDINFO also demonstrates how to use the ToolTip common control to implement a tool tip. This tool tip displays the audio track length corresponding to the cursor's location in the piechart.

The CDINFO attributes sample is the attributed version of this sample.

Building and Running the Sample

To build and run this sample

  1. Open the solution file CDInfo.sln.
  2. From the Build menu, click Build.
  3. After the sample builds, open CDInfo.htm in your Web browser and follow its instructions.

Properties and Methods

The control implements the following methods:

Read   Reads the track length information from the CD currently in the drive and displays the information in the form of a piechart.

Redraw   Redraws the piechart for the current CD.

Play   Starts playing the CD at the specified track number. The control also rotates the piechart so that the track playing is at the top.

The following properties are available:

Tracks   The number of tracks on the CD.

Length   The length of the specified track number in seconds.

TotalLength   The total length of the CD in seconds.


This sample uses the following keywords:

BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CComCoClass; CComControl; CComObjectRoot; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL; CONNECTION_POINT_ENTRY; CProxyCDEvents; CreateBrushIndirect; CreateRectRgn; DECLARE_REGISTRY_RESOURCEID; DeleteDC; DeleteObject; DrawCD; Ellipse; END_COM_MAP; END_CONNECTION_POINT_MAP; END_MSG_MAP; END_OBJECT_MAP; END_PROPERTY_MAP; IConnectionPointContainerImpl; IConnectionPointImpl; IDataObjectImpl; IDispatchImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleLinkImpl; IOleObjectImpl; IPerPropertyBrowsingImpl; IPersistStorageImpl; IPersistStreamInitImpl; IPropertyNotifySinkCP; IProvideClassInfo2Impl; IQuickActivateImpl; IRunnableObjectImpl; IViewObjectExImpl; LineTo; mciSendCommand; MESSAGE_HANDLER; MoveToEx; OBJECT_ENTRY; ReduceRect; RelayEvent; SelectClipRgn; SelectObject; VariantInit; ZeroMemory

See Also

ATL Samples

© 2016 Microsoft