The CDINFO attributes 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
| Security Note |
|---|
This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. |
Building and Running the Sample
To build and run this sample
Open the solution file CDInfo.sln.
From the Build menu, click Build.
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
Attributes
This sample uses the following attributes:
coclass, default, dispinterface, dual, emitidl, event_source, helpstring, id, implements_category, in, module, object, out, pointer_default, progid, propget, propput, registration_script, retval, threading, uuid, version, vi_progid
Keywords
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
| Note |
|---|
Some of the samples, such as this one, have not been modified to reflect the changes in the Visual C++ wizards, libraries, and compiler, but still demonstrate how to complete your desired task. |