CDINFO: Plays and Displays Information about CD Audio Tracks

Click to open or copy the CDINFO project files.

This 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.

There is a VB sample in the VBTEST subdirectory that demonstrates use of the control.

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