VB MCI Control Does Not Support PC Speaker Driver

ID Number: Q84268

1.00

WINDOWS

Summary:

The MCI custom control provided with Microsoft Professional Toolkit

for Visual Basic 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.

This information applies to the MCI.VBX custom control provided with

Microsoft Professional Toolkit for Microsoft Visual Basic programming

system version 1.0 for Windows.

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 custom control provided with

the Visual Basic Professional Toolkit to create and play a linked

Sound Recorder object from your Visual Basic program. The following

is an example. (Note that you must have the appropriate Windows sound

drivers loaded in order to run this program.):

1. Run Visual Basic, or from the File menu, choose New Project (ALT,

F, N) if Visual Basic is already running. Form1 is created by

default.

2. From the File menu, choose Add File. In the Files box, select the

OLECLIEN.VBX custom control file. The OLE Client tool appears in

the Toolbox.

3. Double-click on the OLE Client control on the tool bar to create an

OLE Client control on your form.

4. Double-click on the form to open the Code window, and enter the

following code in the Form_Click event:

OLEClient1.Class = "SoundRec"

OLEClient1.Protocol = "StdFileEditing"

OLEClient1.SourceDoc = "C:\windows\chimes.wav" 'Name of WAV file

OLEClient1.SourceItem = "LINK"

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

5. Press F5 to run the program.

The specified .wav file should be played each time you click on 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

Reference(s):

"Microsoft Professional Toolkit for Visual Basic: Custom Control

Reference," pages 269-295

Additional reference words: 1.00