Microsoft KB Archive/84268

= VB MCI Control Does Not Support PC Speaker Driver =

Article ID: 84268

Article Last Modified on 11/18/2003

-

APPLIES TO


 * Microsoft Visual Basic 2.0 Professional Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Professional Toolkit for Microsoft Visual Basic programming system for Windows

-



This article was previously published under Q84268



SUMMARY
The MCI custom does not support playing wave (.WAV) sound files through a PC speaker driver such as SPEAKER.DRV. The MCI custom control (and the Windows Media Player application) uses the MCI sound drivers, which do not support the PC speaker. The Windows default sounds and the Sound Recorder application are the only way to play sounds through the SPEAKER.DRV PC speaker driver.



MORE INFORMATION
The MCI control manages the recording and playback of multimedia files on Media Control Interface (MCI) devices, such as audio boards, MIDI sequencers, CD-ROM drives, audio CD players, video disc players, and videotape recorders and players.

Although the MCI control will not allow you to play .WAV files through the PC speaker, you can use the OLE Client Controls provided with the Professional Edition of the Microsoft Visual Basic for Windows, or with the Microsoft Visual Basic for Windows Professional Toolkit to create and play a linked Sound Recorder object from your Visual Basic for Windows program. The following is an example of this behavior. (Note that you must have the appropriate Windows sound drivers loaded in order to run this program):

 Run Visual Basic for Windows, or from the File menu, choose New Project (press ALT, F, N) if Visual Basic for Windows is already running. Form1 is created by default. From the File menu, choose Add File. In the Files box, select the OLECLIEN.VBX custom control file in Visual Basic 2.0 or the MSOLE2.VBX custom control file in Visual Basic 3.0. The OLE Client tool appears in the Toolbox of the Visual Basic 2.0 product, the OLE 2.0 tool appears in the Toolbox of the Visual Basic 3.0 product. Double-click the OLE Client control on the toolbar to create an OLE Client control on your form in Visual Basic 2.0, or double-click the OLE 2.0 control on the toolbar to create an OLE control on your form in Visual Basic 3.0.  Double-click the form to open the Code window, and enter the following code in the Form_Click event for Visual Basic 2.0: OLEClient1.Class = &quot;SoundRec&quot; OLEClient1.Protocol = &quot;StdFileEditing&quot; OLEClient1.SourceDoc = &quot;C:\windows\chimes.wav&quot;  ' Name of .WAV file. OLEClient1.SourceItem = &quot;LINK&quot; OLEClient1.ServerType = 0     ' Linked object.

OLEClient1.Action = 1     ' Create object from source file. OLEClient1.Action = 7     ' Activate Sound Recorder - plays sound. OLEClient1.Action = 10    ' Delete the object.

-or-   Double-click the form to open the Code window, and enter the following code in the Form_Click event for Visual Basic 3.0: OLE1.Class = &quot;SoundRec&quot; OLE1.SourceDoc = &quot;C:\windows\chimes.wav&quot;  ' Name of .WAV file. OLE1.SourceItem = &quot;LINK&quot;

OLE1.Action = 1     ' Create object from source file. OLE1.Action = 7     ' Activate Sound Recorder - plays sound. OLE1.Action = 10    ' Delete the object.

 Press the F5 key to run the program.</ol>

The specified .WAV file should be played each time you click the form.

For more information on SPEAKER.DRV, query on the following words in the Microsoft Knowledge Base:

SPEAKER.DRV and WDL AND windows AND 3.10

Additional query words: 1.00 2.00 3.00 MCI.VBX

Keywords: KB84268

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.