Multimedia MCI Control

The Multimedia MCI control manages the recording and playback of multimedia files on Media Control Interface (MCI) devices. Conceptually, this control is a set of push buttons that issues MCI commands to devices such as audio boards, MIDI sequencers, CD-ROM drives, audio CD players, videodisc players, and videotape recorders and players. The MCI control also supports the playback of Video for Windows (*.avi) files.

When you add the Multimedia MCI control to a form at design time, the control appears on the form as follows:

The buttons are defined as Prev, Next, Play, Pause, Back, Step, Stop, Record, and Eject, respectively.

Remarks

Your application should already have the MCI device open and the appropriate buttons in the Multimedia MCI control enabled before the user is allowed to choose a button from the Multimedia MCI control. In Visual Basic, place the MCI Open command in the Form_Load event.

When you intend to record audio with the Multimedia MCI control, open a new file. This action ensures that the data file containing the recorded sound will be in a format compatible with your system's recording capabilities. Also, issue the MCI Save command before closing the MCI device to store the recorded data in the file.

The Multimedia MCI control is programmable in several ways:

•	The control can be visible or invisible at run time.

•	You can augment or completely redefine the functionality of the buttons in the control.

•	You can control multiple devices in a form.

If you want to use the buttons in the Multimedia MCI control, set the Visible and Enabled properties to True. If you do not want to use the buttons in the control, but want to use the Multimedia MCI control for its multimedia functionality, set the Visible and Enabled properties to False. An application can control MCI devices with or without user interaction.

The events (button definitions) of the Multimedia MCI control are programmable. You can augment or completely redefine the functionality of these buttons by developing code for the button events.

The MCI extensions support multiple instances of the Multimedia MCI control in a single form to provide concurrent control of several MCI devices. You use one control per device.

Distribution Note   When you create and distribute applications that use the Multimedia MCI control, you should install and register the appropriate files in the customer's Microsoft Windows System or System32 directory. The Setup Wizard included with Visual Basic provides tools to help you write setup programs that install your applications correctly.


Multimedia MCI

Multimedia MCI consists of a set of high-level, device-independent commands that control audio and visual peripherals. The first MCI command you issue is the Open command. This command opens the specified MCI device and identifies the file that will play on the device or be recorded by the device. Some devices, such as CDAudio, VCR, and videodisc, do not use files and do not require file names.

Once the device is open, you can issue any of the other MCI commands (Prev, Next, Pause, and so on). The Close command is the last MCI command you issue for the device, returning it to the available pool of system resources. The Close command also closes the data file associated with the device.

For a list of the MCI commands supported by the Multimedia MCI control, see the Command property. For additional information on Multimedia MCI, refer to the Microsoft Win32 Software Development Kit Multimedia Programmer's Reference.


Examples (Multimedia MCI Control)

Visual Basic Example

The following example illustrates the procedure used to open an MCI device with a compatible data file. By placing this code in the Form_Load procedure, your application can use the Multimedia MCI control "as is" to play, record, and rewind the file Gong.wav. To try this example, first create a form with a Multimedia MCI control.

Private Sub Form_Load ()

' Set properties needed by MCI to open.

MMControl1.Notify = FALSE

MMControl1.Wait = TRUE

MMControl1.Shareable = FALSE

MMControl1.DeviceType = "WaveAudio"

MMControl1.FileName = "C:\WINDOWS\MMDATA\GONG.WAV"

' Open the MCI WaveAudio device.

MMControl1.Command = "Open"

End Sub

To properly manage multimedia resources, you should close those MCI devices that are open before exiting your application. You can place the following statement in the Form_Unload procedure to close an open MCI device before exiting from the form containing the Multimedia MCI control.

Private Sub Form_Unload (Cancel As Integer)

MMControl1.Command = "Close"

End Sub


AutoEnable Property (Multimedia MCI Control)

Determines if the Multimedia MCI control can automatically enable or disable individual buttons in the control. If the AutoEnable property is set to True, the Multimedia MCI control enables those buttons that are appropriate for the current mode of the specified MCI device type. This property also disables those buttons that the current mode of the MCI device does not support.

Syntax

[form.]MMControl.AutoEnable[ = {True | False}]

Remarks

The effect of the AutoEnable property is superseded by the Enabled property. The AutoEnable property can automatically enable or disable individual buttons in the control when the Multimedia MCI control is enabled (Enabled property set to True). When the Enabled property is False, keyboard and mouse run-time access to the Multimedia MCI control are turned off, regardless of the AutoEnable property setting.

The following table lists the AutoEnable property settings for the Multimedia MCI control.

Setting	Description
False	Does not enable or disable buttons. The program controls the states of the buttons by setting the Enabled and ButtonEnabled properties.
True	(Default) Enables buttons whose functions are available and disables buttons whose functions are not.
The following tables show how the MCI mode settings are reflected in the control's property settings.

Play mode

Record mode

Pause mode

Stop mode

Open mode

Seek or Not Ready modes

The effect of the AutoEnable property supersedes the effects of ButtonEnabled properties. When the Enabled and AutoEnable properties are both True, the ButtonEnable properties are not used.

Data Type

Integer (Boolean)


Play mode

Button	Status
Back*	Enabled
Eject*	Enabled
Next	Enabled
Pause	Enabled
Play*	Disabled
Prev	Enabled
Record*	Disabled
Step*	Enabled
Stop	Enabled
*Button is enabled if the operation is supported by the open MCI device.


Record mode

Button	Status
Back*	Enabled
Eject*	Enabled
Next	Enabled
Pause	Enabled
Play*	Disabled
Prev	Enabled
Record*	Disabled
Step*	Enabled
Stop	Enabled
*Button is enabled if the operation is supported by the open MCI device.


Pause mode

Button	Status
Back*	Enabled
Eject*	Enabled
Next	Enabled
Pause	Enabled
Play*	Enabled
Prev	Enabled
Record*	Enabled
Step*	Enabled
Stop	Enabled
*Button is enabled if the operation is supported by the open MCI device.


Stop mode

Button	Status
Back*	Enabled
Eject*	Enabled
Next	Enabled
Pause	Disabled
Play*	Enabled
Prev	Enabled
Record*	Enabled
Step*	Enabled
Stop	Disabled
*Button is enabled if the operation is supported by the open MCI device.


Open mode

Button	Status
Back*	Disabled
Eject*	Enabled
Next	Disabled
Pause	Disabled
Play*	Disabled
Prev	Disabled
Record*	Disabled
Step*	Disabled
Stop	Disabled
*Button is enabled if the operation is supported by the open MCI device.


Seek or Not Ready modes

Button	Status
Back*	Disabled
Eject*	Disabled
Next	Disabled
Pause	Disabled
Play*	Disabled
Prev	Disabled
Record*	Disabled
Step*	Disabled
Stop	Disabled
*Button is enabled if the operation is supported by the open MCI device.


ButtonEnabled Property (Multimedia MCI Control)

Determines if a button in the control is enabled or disabled (a disabled button appears dimmed).

Syntax

[form.]MMControl.ButtonEnabled[ = {True | False}]

Remarks

The effects of the ButtonEnabled properties are superseded by the Enabled and AutoEnable properties. Individual ButtonEnabled properties enable or disable the associated buttons in the Multimedia MCI control when the Multimedia MCI control is enabled (Enabled property set to True) and the AutoEnable property is turned off (set to False).

For this property, Button may be any of the following: Back, Eject, Next, Pause, Play, Prev, Record, Step, or Stop. For example, to disable the Play button, use:

[form.]MMControl.PlayEnabled = False

To check whether the Record button is enabled, use:

If [form.]MMControl.RecordEnabled Then ..

The following table lists the ButtonEnabled property settings for the Multimedia MCI control.

Setting	Description
False	(Default) Disables (dims) the button specified by Button. This button's function is not available in the control.
True	Enables the button specified by Button. This button's function is available in the control.
Data Type

Integer (Boolean)


ButtonVisible Property (Multimedia MCI Control)

Determines if the specified button is displayed in the control.

Syntax

[form.]MMControl.ButtonVisible[ = {True | False}]

Remarks

The effects of the ButtonVisible properties are superseded by the Visible property. Individual ButtonVisible properties display and hide the associated buttons in the Multimedia MCI control when the Multimedia MCI control is visible (Visible property set to True). If the Multimedia MCI control is invisible, these properties are not used.

For this property, Button may be any of the following: Back, Eject, Next, Pause, Play, Prev, Record, Step, or Stop.

The following table lists the ButtonVisible property settings for the Multimedia MCI control.

Setting	Description
False	Does not display the button specified by Button. This button's function is not available in the control.
True	(Default) Displays the button specified by Button.
Data Type

Integer (Boolean)


CanEject Property (Multimedia MCI Control)

Determines if the open MCI device can eject its media. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.CanEject

Remarks

The following table lists the CanEject property settings for the Multimedia MCI control.

Setting	Description
False	(Default) The device cannot eject its media.
True	The device can eject its media.
The value of CanEject is retrieved using MCI_GETDEVCAPS during the processing of an Open command.

Data Type

Integer (Boolean)


CanPlay Property (Multimedia MCI Control)

Determines if the open MCI device can play. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.CanPlay

Remarks

The following table lists the CanPlay property settings for the Multimedia MCI control.

Setting	Description
False	(Default) The device cannot play.
True	The device can play.
The value of CanPlay is retrieved using MCI_GETDEVCAPS during the processing of an Open command.

Data Type

Integer (Boolean)


CanRecord Property (Multimedia MCI Control)

Determines if the open MCI device can record. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.CanRecord

Remarks

The following table lists the CanRecord property settings for the Multimedia MCI control.

Setting	Description
False	(Default) The device cannot record.
True	The device can record.
The value of CanRecord is retrieved using MCI_GETDEVCAPS during the processing of an Open command.

Data Type

Integer (Boolean)


CanStep Property (Multimedia MCI Control)

Determines if the open MCI device can step a frame at a time. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.CanStep

Remarks

The following table lists the CanStep property settings for the Multimedia MCI control.

Setting	Description
False	(Default) The device cannot step a frame at a time.
True	The device can step a frame at a time.
Currently only MMMovie, Overlay, and VCR MCI devices can step a frame at a time. Because there is no way to check whether a device can step, programs set the value of this property by checking if the device type is MMMovie, Overlay, or VCR during the processing of an Open command.

Data Type

Integer (Boolean)


Command Property (Multimedia MCI Control)

Specifies an MCI command to execute. This property is not available at design time.

Syntax

[form.]MMControl.Command[ = cmdstring$]

Remarks

The cmdstring$ argument gives the name of the MCI command to execute: Open, Close, Play, Pause, Stop, Back, Step, Prev, Next, Seek, Record, Eject, Sound, or Save. The command is executed immediately, and the error code is stored in the Error property.

The following table describes each command and lists the properties it uses. If a property is not set, either a default value is used (shown in parentheses following the property name), or the property is not used at all (if no default value is shown).

Command	Description/Properties used
Open	Opens a device using the MCI_OPEN command.
	Notify (False)
	Wait (True)
	Shareable
	DeviceType
	FileName
Close	Closes a device using the MCI_CLOSE command.
	Notify (False)
	Wait (True)
Play	Plays a device using the MCI_PLAY command.
	Notify (True)
	Wait (False)
	From
	To
Pause	Pauses playing or recording using the MCI_PLAY command. If executed while the device is paused, tries to resume playing or recording using the MCI_RESUME command.
	Notify (False)
	Wait (True)
Stop	Stops playing or recording using the MCI_STOP command.
	Notify (False)
	Wait (True)
Back	Steps backward using the MCI_STEP command.
	Notify (False)
	Wait (True)
	Frames
Step	Steps forward using the MCI_STEP command.
	Notify (False)
	Wait (True)
	Frames
Prev	Goes to the beginning of the current track using the Seek command. If executed within three seconds of the previous Prev command, goes to the beginning of the previous track or to the beginning of the first track if at the first track.
	Notify (False)
	Wait (True)
Next	Goes to the beginning of the next track (if at last track, goes to beginning of last track) using the Seek command.
	Notify (False)
	Wait (True)
Seek	If not playing, seeks a position using the MCI_SEEK command. If playing, continues playing from the given position using the MCI_PLAY command.
	Notify (False)
	Wait (True)
	To
Record	Records using the MCI_RECORD command.
	Notify (True)
	Wait (False)
	From
	To
	RecordMode (0Insert)
Eject	Ejects media using the MCI_SET command.
	Notify (False)
	Wait (True)
Sound	Plays a sound using the MCI_SOUND command.
	Notify (False)
	Wait (False)
	FileName
Save	Saves an open file using the MCI_SAVE command.
	Notify (False)
	Wait (True)
	FileName
Data Type

String


DeviceID Property (Multimedia MCI Control)

Specifies the device ID for the currently open MCI device. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.DeviceID[ = id%]

Remarks

The argument id% is the device ID of the currently open MCI device. This ID is obtained from MCI_OPEN as a result of an Open command. If no device is open, this argument is 0.

Data Type

Integer


DeviceType Property (Multimedia MCI Control)

Specifies the type of MCI device to open.

Syntax

[form.]MMControl.DeviceType[ = device$]

Remarks

The argument device$ is the type of MCI device to open: AVIVideo, CDAudio, DAT, DigitalVideo, MMMovie, Other, Overlay, Scanner, Sequencer, VCR, Videodisc, or WaveAudio.

The value of this property must be set when opening simple devices (such as an audio CD that does not use files). It must also be set when opening compound MCI devices when the file-name extension does not specify the device to use.

Data Type

String


Enabled Property (Multimedia MCI Control)

Determines if the control can respond to user-generated events, such as the KeyPress and mouse events.

Syntax

[form.]MMControl.Enabled[ = {True | False}]

Remarks

This property permits the Multimedia MCI control to be enabled or disabled at run time. The effect of the Enabled property supersedes the effects of the AutoEnable and ButtonEnabled properties. For example, if the Enabled property is False, the Multimedia MCI control does not permit access to its buttons, regardless of the settings of the AutoEnable and ButtonEnabled properties.

The following table lists the Enabled property settings for the Multimedia MCI control.

Setting	Description
False	All buttons on the control are disabled (dimmed).
True	(Default) The control is enabled. Use the AutoEnable property to let the Multimedia MCI control automatically enable or disable the buttons in the control. Or, use the ButtonEnabled properties to enable or disable individual buttons in the control.
Data Type

Integer (Boolean)


Error Property (Multimedia MCI Control)

Specifies the error code returned from the last MCI command. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.Error

Remarks

If the last MCI command did not cause an error, this value is 0.

Data Type

Integer


ErrorMessage Property (Multimedia MCI Control)

Describes the error code stored in the Error property. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.ErrorMessage

Data Type

String


FileName Property (Multimedia MCI Control)

Specifies the file to be opened by an Open command or saved by a Save command. To change the FileName property at run time, you must close and reopen the Multimedia MCI control.

Syntax

[form.]MMControl.FileName[ = stringexpression$]

Remarks

The argument stringexpression$ specifies the file to be opened or saved.

Data Type

String


FileName Property Example (Multimedia MCI Control)

Visual Basic Example

To change the FileName property of a Multimedia MCI control at run time, you must close and then reopen the Multimedia MCI control.

The following example finds a selected item, closes the Multimedia MCI Control, resets the DeviceType property, resets the FileName property with the selected item, then reopens the Multimedia MCI control. To try the example, place a Multimedia MCI control and a FileListBox on a form, and paste the code into the  Declarations section of the form.

Private Sub File1_Click()

Dim i As Integer

For i = 0 To File1.ListCount - 1

If File1.Selected(i) = True Then

MMControl1.Command = "close"

MMControl1.DeviceType = "WaveAudio"

MMControl1.FileName = "c:\windows\" & File1.List(i)

MMControl1.Command = "open"

End If

Next i

End Sub


Frames Property (Multimedia MCI Control)

Specifies the number of frames the Step command steps forward or the Back command steps backward. This property is not available at design time.

Syntax

[form.]MMControl.Frames[ = frames&]

Remarks

The argument frames& specifies the number of frames to step forward or backward.

Data Type

Long


From Property (Multimedia MCI Control)

Specifies the starting point, as defined by the Multimedia MCI control TimeFormat property, for the Play or Record command. This property is not available at design time.

Syntax

[form.]MMControl.From[ = location&]

Remarks

The argument location& specifies the starting point for the play or record operation. The current time format is given by the TimeFormat property.

The value you assign to this property is used only with the next MCI command. Subsequent MCI commands ignore the From property until you assign it another (different or identical) value.

Data Type

Long


hWndDisplay Property (Multimedia MCI Control)

Specifies the output window for MCI MMMovie or Overlay devices that use a window to display output. This property is not available at design time.

Syntax

[form.]MMControl.hWndDisplay

Remarks

This property is a handle to the window that the MCI device uses for output. If the handle is 0, a default window (also known as the "stage window") is used.

To determine whether a device uses this property, look at the UsesWindows property settings.

In Visual Basic, to get a handle to a control, first use the SetFocus method to set the focus to the desired control. Then call the Windows GetFocus function.

To get a handle to a Visual Basic form, use the hWnd property for that form.

Data Type

Integer


Length Property (Multimedia MCI Control)

Specifies the length, as defined by the Multimedia MCI control TimeFormat property, of the media in an open MCI device. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.Length

Data Type

Long


Mode Property (Multimedia MCI Control)

Returns the current mode of an open MCI device. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.Mode

Remarks

The following table lists the Mode property return values for the Multimedia MCI control.

Value	Setting/Device mode	Description
524	mciModeNotOpen	Device is not open.
525	mciModeStop	Device is stopped.
526	mciModePlay	Device is playing.
527	mciModeRecord	Device is recording.
528	mciModeSeek	Device is seeking.
529	mciModePause	Device is paused.
530	mciModeReady	Device is ready.
Data Type

Long


Notify Property (Multimedia MCI Control)

Determines if the next MCI command uses MCI notification services. If set to True, the Notify property generates a callback event (Done), which occurs when the next MCI command is complete. This property is not available at design time.

Syntax

[form.]MMControl.Notify[ = {True | False}]

Remarks

The following table lists the Notify property settings for the Multimedia MCI control.

Setting	Description
False	(Default) The next command does not generate the Done event.
True	The next command generates the Done event.
The value assigned to this property is used only with the next MCI command. Subsequent MCI commands ignore the Notify property until it is assigned another (different or identical) value.

Note   A notification message is aborted when you send a new command that prevents the callback conditions set by a previous command, from being satisfied. For example, to restart a paused device that does not support the MCI Resume command, the Multimedia MCI control sends the Play command to the paused device. However, the Play command that restarts the device sets callback conditions, superseding callback conditions and pending notifications from earlier commands.

Data Type

Integer (Boolean)


NotifyMessage Property (Multimedia MCI Control)

Describes the notify code returned in the Done event, triggered by the Notify Property. The NotifyMessage property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.NotifyMessage

Data Type

String


NotifyValue Property (Multimedia MCI Control)

Specifies the result of the last MCI command that requested a notification. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.NotifyValue

Remarks

The following table lists the NotifyValue return values for the Multimedia MCI control.

Value	Setting/Device mode
1	mciNotifySuccessful
	Command completed successfully.
2	mciNotifySuperseded
	Command was superseded by another command.
4	mciNotifyAborted
	Command was aborted by the user.
8	mciNotifyFailure
	Command failed.
The program can check the Notify code returned in the Done event to determine this value for the most recent MCI command.

Data Type

Integer (Enumerated)


Orientation Property (Multimedia MCI Control)

Determines whether buttons on the control are arranged vertically or horizontally.

Syntax

[form.]MMControl.Orientation[ = orientation%]

Remarks

The following table lists the Orientation property settings for the Multimedia MCI control.

Constant	Value	Description
mciOrientHorz	0	Buttons are arranged horizontally.
mciOrientVert	1	Buttons are arranged vertically.
Data Type

Integer (Enumerated)


Position Property (Multimedia MCI Control)

Specifies, as defined by the Multimedia MCI control TimeFormat property, the current position of an open MCI device. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.Position

Data Type

Long


RecordMode Property (Multimedia MCI Control)

Specifies the current recording mode for those MCI devices that support recording.

Syntax

[form.]MMControl.RecordMode[ = mode%]

Remarks

The following table lists the RecordMode property settings for the Multimedia MCI control.

Constant	Value	Recording mode
mciRecordInsert	0	Insert
mciRecordOverwrite	1	Overwrite
To determine whether a device supports recording, check the CanRecord property.

A device that supports recording may support either or both of the recording modes. There is no way to check ahead of time which mode a device supports. If recording with a particular mode fails, try the other mode.

WaveAudio devices support Insert mode only.

Data Type

Integer (Enumerated)


Shareable Property (Multimedia MCI Control)

Determines if more than one program can share the same MCI device.

Syntax

[form.]MMControl.Shareable[ = {True | False}]

Remarks

The following table lists the Shareable property settings for the Multimedia MCI control.

Setting	Description
False	No other controls or applications can access this device.
True	More than one control or application can open this device.
Data Type

Integer (Boolean)


Silent Property (Multimedia MCI Control)

Determines if sound plays.

Syntax

[form.]MMControl.Silent[ = {True | False}]

Remarks

The following table lists the Silent property settings for the Multimedia MCI control.

Setting	Description
False	Any sound present is played.
True	Sound is turned off.
Data Type

Integer (Boolean)


Start Property (Multimedia MCI Control)

Specifies, as defined in the Multimedia MCI control TimeFormat property, the starting position of the current media. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.Start

Data Type

Long


TimeFormat Property (Multimedia MCI Control)

Specifies the time format used to report all position information.

Syntax

[form.]MMControl.TimeFormat[ = format&]

Remarks

The following table lists the TimeFormat property settings for the Multimedia MCI control.

Value	Setting/Time format
0	mciFormatMilliseconds
	Milliseconds are stored as a 4-byte integer variable.
1	mciFormatHms
	Hours, minutes, and seconds are packed into a 4-byte integer. From least significant byte to most significant byte, the individual data values are:
	Hours (least significant byte)
	Minutes
	Seconds
	Unused (most significant byte)
2	mciFormatMsf
	Minutes, seconds, and frames are packed into a 4-byte integer. From least significant byte to most significant byte, the individual data values are:
	Minutes (least significant byte)
	Seconds
	Frames
	Unused (most significant byte)
3	mciFormatFrames
	Frames are stored as a 4-byte integer variable.
4	mciFormatSmpte24
	24-frame SMPTE packs the following values in a 4-byte variable from least significant byte to most significant byte:
	Hours (least significant byte)
	Minutes
	Seconds
	Frames (most significant byte)
	SMPTE (Society of Motion Picture and Television Engineers) time is an absolute time format expressed in hours, minutes, seconds, and frames. The standard SMPTE division types are 24, 25, and 30 frames per second.
5	mciFormatSmpte25
	25-frame SMPTE packs data into the 4-byte variable in the same order as 24-frame SMPTE.
6	mciFormatSmpte30
	30-frame SMPTE packs data into the 4-byte variable in the same order as 24-frame SMPTE.
7	mciFormatSmpte30Drop
	30-drop-frame SMPTE packs data into the 4-byte variable in the same order as 24-frame SMPTE.
8	mciFormatBytes
	Bytes are stored as a 4-byte integer variable.
9	mciFormatSamples
	Samples are stored as a 4-byte integer variable.
10	mciFormatTmsf
	Tracks, minutes, seconds, and frame are packed in the 4-byte variable from least significant byte to most significant byte:
	Tracks (least significant byte)
	Minutes
	Seconds
	Frames (most significant byte)
	Note   MCI uses continuous track numbering.
Note   Not all formats are supported by every device. If you try to set an invalid format, the assignment is ignored.

The current timing information is always passed in a 4-byte integer. In some formats, the timing information returned is not really an integer, but single bytes of information packed in the long integer. Properties that access or send information in the current time format are: From, Length, Position, Start, To, TrackLength, TrackPosition.

Data Type

Long (Enumerated)


To Property (Multimedia MCI Control)

Specifies the ending point, as defined in the Multimedia MCI control TimeFormat property, for the Play or Record command. This property is not available at design time.

Syntax

[form.]MMControl.To[ = location&]

Remarks

The argument location& specifies the ending point for the play or record operation. The current time format is given by the TimeFormat property.

The value assigned to this property is used only with the next MCI command. Subsequent MCI commands ignore the To property until it is assigned another (different or identical) value.

Data Type

Long


Track Property (Multimedia MCI Control)

Specifies the track about which the TrackLength and TrackPosition properties return information. This property is not available at design time.

Syntax

[form.]MMControl.Track[ = track&]

Remarks

The argument track& specifies the track number.

This property is used only to get information about a particular track. It has no relationship to the current track.

Data Type

Long


TrackLength Property (Multimedia MCI Control)

Specifies the length, as defined in the Multimedia MCI control TimeFormat property, of the track given by the Track property. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.TrackLength

Data Type

Long


TrackPosition Property (Multimedia MCI Control)

Specifies the starting position, as defined in the Multimedia MCI control TimeFormat property, of the track given by the Track property. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.TrackPosition

Data Type

Long


Tracks Property (Multimedia MCI Control)

Specifies the number of tracks available on the current MCI device. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.Tracks

Data Type

Long


UpdateInterval Property (Multimedia MCI Control)

Specifies the number of milliseconds between successive StatusUpdate events.

Syntax

[form.]MMControl.UpdateInterval[ = milliseconds%]

Remarks

The argument milliseconds% specifies the number of milliseconds between events. If milliseconds is 0, no StatusUpdate events occur.

Data Type

Integer


UsesWindows Property (Multimedia MCI Control)

Determines if the currently open MCI device uses a window for output. This property is not available at design time and is read-only at run time.

Syntax

[form.]MMControl.UsesWindows

Remarks

The following table lists the UsesWindows property return values for the Multimedia MCI control.

Value	Description
False	The current device does not use a window for output.
True	The current device uses a window.
Currently, only MMMovie and Overlay devices use windows for display. Because there is no way to determine whether a device uses windows, the value of UsesWindows is set during processing of an Open command by checking the device type. If the device type is MMMovie, Overlay, or VCR, the device uses windows.

For devices that use windows, you can use the hWndDisplay property to set the window that will display output.

Data Type

Integer (Boolean)


Visible Property (Multimedia MCI Control)

Determines if the Multimedia MCI control is visible or invisible at run time.

Syntax

[form.]MMControl.Visible[ = {True | False}]

Remarks

The effect of the Visible property supersedes the effects of the individual ButtonVisible properties. When the Multimedia MCI control is visible, the individual ButtonVisible properties govern the visibility of the associated buttons in the control. When the Visible property is False, the entire control is invisible, and the ButtonVisible properties are not used.

The following table lists the Visible property settings for the Multimedia MCI control.

Setting	Description
False	The control is invisible.
True	(Default) Each button is visible or hidden individually, depending on its ButtonVisible property. This button's function is still available in the control.
Data Type

Integer (Boolean)


Wait Property (Multimedia MCI Control)

Determines whether the Multimedia MCI control waits for the next MCI command to complete before returning control to the application. This property is not available at design time.

Syntax

[form.]MMControl.Wait[ = {True | False}]

Remarks

The following table lists the Wait property settings for the Multimedia MCI control.

Setting	Description
False	Multimedia MCI does not wait until the MCI command completes before returning control to the application.
True	Multimedia MCI waits until the next MCI command completes before returning control to the application.
The value assigned to this property is used only with the next MCI command. Subsequent MCI commands ignore the Wait property until it is assigned another (different or identical) value.

Data Type

Integer (Boolean)


ButtonClick Event (Multimedia MCI Control)

Occurs when the user presses and releases the mouse button over one of the buttons in the Multimedia MCI control.

Syntax

Private Sub MMControl_ButtonClick (Cancel As Integer)

Remarks

Button may be any of the following: Back, Eject, Next, Pause, Play, Prev, Record, Step, or Stop.

Each of the ButtonClick events, by default, perform an MCI command when the user chooses a button. The following table lists the MCI commands performed for each button in the control.

Button	Command
Back	MCI_STEP
Step	MCI_STEP
Play	MCI_PLAY
Pause	MCI_PAUSE
Prev	MCI_SEEK
Next	MCI_SEEK
Stop	MCI_STOP
Record	MCI_RECORD
Eject	MCI_SET with the MCI_SET_DOOR_OPEN parameter
Setting the Cancel parameter for the ButtonClick event to True prevents the default MCI command from being performed. The Cancel parameter can take either of the following settings.

Setting	Description
True	Prevents the default MCI command from being performed.
False	Performs the MCI command associated with the button after performing the body of the appropriate ButtonClick event.
The body of an event procedure is performed before performing the default MCI command associated with the event. Adding code to the body of the ButtonClick events augments the functionality of the buttons. If you set the Cancel parameter to True within the body of an event procedure or pass the value True as the argument to a ButtonClick event procedure, the default MCI command associated with the event will not be performed.

Note   Issuing a Pause command to restart a paused device can end pending notifications from the original Play command if the device does not support the MCI Resume command. The Multimedia MCI control uses the MCI Play command to restart devices that do not support the MCI Resume command. Notifications from the Play command that restarts a paused device cancel callback conditions and supersede pending notifications from the original Play command.


ButtonCompleted Event (Multimedia MCI Control)

Occurs when the MCI command activated by a Multimedia MCI control button finishes.

Syntax

Private Sub MMControl_ButtonCompleted (Errorcode As Long)

Remarks

Button may be any of the following: Back, Eject, Next, Pause, Play, Prev, Record, Step, or Stop.

The Errorcode argument can take the following settings.

Setting	Description
0	Command completed successfully.
Any other value	Command did not complete successfully.
If the Cancel argument is set to True during a ButtonClick event, the ButtonCompleted event is not triggered.


ButtonGotFocus Event (Multimedia MCI Control)

Occurs when a button in the Multimedia MCI control receives the input focus.

Syntax

Private Sub MMControl_ButtonGotFocus ()

Remarks

Button may be any of the following: Back, Eject, Next, Pause, Play, Prev, Record, Step, or Stop.


ButtonLostFocus Event (Multimedia MCI Control)

Occurs when a button in the Multimedia MCI control loses the input focus.

Syntax

Private Sub MMControl_ButtonLostFocus ()

Remarks

Button may be any of the following: Back, Eject, Next, Pause, Play, Prev, Record, Step, or Stop.


Done Event (Multimedia MCI Control)

Occurs when an MCI command for which the Notify property is True finishes.

Syntax

Private Sub MMControl_Done (NotifyCode As Integer)

Remarks

The NotifyCode argument indicates whether the MCI command succeeded. It can take any of the following settings.

Value	Setting/Result
1	mciSuccessful
	Command completed successfully.
2	mciSuperseded
	Command was superseded by another command.
4	mciAborted
	Command was aborted by the user.
8	mciFailure
	Command failed.


StatusUpdate Event (Multimedia MCI Control)

Occurs automatically at intervals given by the UpdateInterval property.

Syntax

Private Sub MMControl_StatusUpdate ()

Remarks

This event allows an application to update the display to inform the user about the status of the current MCI device. The application can obtain status information from properties such as Position, Length, and Mode.


Multimedia MCI Control Constants

Mode Constants

Constant	Value	Description
mciModeNotOpen	524	Device not open.
mciModeStop	525	Device stop.
mciModePlay	526	Device play.
mciModeRecord	527	Device record.
mciModeSeek	528	Device seek.
mciModePause	529	Device pause.
mciModeReady	530	Device ready.
Notify Constants

Constant	Value	Description
mciNotifySuccessful	1	Command completed successfully.
mciNotifySuperseded	2	Command superseded by another command.
mciAborted	4	Command aborted by user.
mciFailure	8	Command failed.
Orientation Constants

Constant	Value	Description
mciOrientHorz	0	Buttons arranged horizontally.
mciOrientVert	1	Buttons arranged vertically.
RecordMode Constants

Constant	Value	Description
mciRecordInsert	0	Insert recording mode.
mciRecordOverwrite	1	Overwrite recording mode.
Format Constants

Constant	Value	Description
mciFormatMilliseconds	0	Milliseconds format.
mciFormatHms	1	Hours, seconds, and minutes format.
mciFormatMsf	2	Minutes, seconds, and frames format.
mciFormatFrames	3	Frames format.
mciFormatSmpte24	4	24-frame SMPTE format.
mciFormatSmpte25	5	25-frame SMPTE format.
mciFormatSmpte30	6	30-frame SMPTE format.
mciFormatSmpte30Drop	7	30-drop-frame SMPTE format.
mciFormatBytes	8	Bytes format.
mciFormatSamples	9	Samples format.
mciFormatTmsf	10	Tracks minutes, seconds, and frames format.


Error Messages (Multimedia MCI Control)

The following table lists the trappable errors for the Multimedia MCI control.

Constant	Value	Description
mciInvalidProcedureCall	5	Invalid procedure call.
mciInvalidProertyValue	380	invalid property value.
mciSetNotSupported	383	Property is read-only.
mciGetNotSupported	394	Property is write-only.
mciInvalidObjectUse	425	Invalid object use.
mciWrongClipboardFormat	461	Specified format doesn't match format of data.
mciObjectLocked	672	DataObject formats list may not be cleared or expanded outside of the OLEStartDrag event.
mciExpectedArgument	673	Expected at least one argument.
mciRecursiveOleDrag	674	Illegal recursive invocation of OLE drag and drop
mciFormatNotByteArray	675	Non-intrinsic OLE drag and drop formats used with SetData require Byte array data.  GetData may return more bytes than were given to SetData.
mciDataNotSetForFormat	676	Requested data was not supplied to the DataObject during the OLESetData event.
mciCantCreateButton	30001	Can't create button
mciCantCreateTimer	30002	Can't create a timer resource
mciUnsupportedFunction	30004	Unsupported function
Below is a list of the MCI error strings and numbers that are related to the Multimedia MCI control.

MCI Error Strings	MCI Error Numbers
MCIERR_BASE	256
MCIERR_INVALID_DEVICE_ID	257
MCIERR_UNRECOGNIZED_KEYWORD	259
MCIERR_UNRECOGNIZED_COMMAND	261
MCIERR_HARDWARE	262
MCIERR_INVALID_DEVICE_NAME	263
MCIERR_OUT_OF_MEMORY	264
MCIERR_DEVICE_OPEN	265
MCIERR_CANNOT_LOAD_DRIVER	266
MCIERR_MISSING_COMMAND_STRING	267
MCIERR_PARAM_OVERFLOW	268
MCIERR_MISSING_STRING_ARGUMENT	269
MCIERR_BAD_INTEGER	270
MCIERR_PARSER_INTERNAL	271
MCIERR_DRIVER_INTERNAL	272
MCIERR_MISSING_PARAMETER	273
MCIERR_UNSUPPORTED_FUNCTION	274
MCIERR_FILE_NOT_FOUND	275
MCIERR_DEVICE_NOT_READY	276
MCIERR_INTERNAL	277
MCIERR_DRIVER	278
MCIERR_CANNOT_USE_ALL	279
MCIERR_MULTIPLE	280
MCIERR_EXTENSION_NOT_FOUND	281
MCIERR_OUTOFRANGE	282
MCIERR_FLAGS_NOT_COMPATIBLE	283
MCIERR_FILE_NOT_SAVED	286
MCIERR_DEVICE_TYPE_REQUIRED	287
MCIERR_DEVICE_LOCKED	288
MCIERR_DUPLICATE_ALIAS	289
MCIERR_BAD_CONSTANT	290
MCIERR_MUST_USE_SHAREABLE	291
MCIERR_MISSING_DEVICE_NAME	292
MCIERR_BAD_TIME_FORMAT	293
MCIERR_NO_CLOSING_QUOTE	294
MCIERR_DUPLICATE_FLAGS	295
MCIERR_INVALID_FILE	296
MCIERR_NULL_PARAMETER_BLOCK	297
MCIERR_UNNAMED_RESOURCE	298
MCIERR_NEW_REQUIRES_ALIAS	299
MCIERR_NOTIFY_ON_AUTO_OPEN	300
MCIERR_NO_ELEMENT_ALLOWED	301
MCIERR_NONAPPLICABLE_FUNCTION	302
MCIERR_ILLEGAL_FOR_AUTO_OPEN	303
MCIERR_FILENAME_REQUIRED	304
MCIERR_EXTRA_CHARACTERS	305
MCIERR_DEVICE_NOT_INSTALLED	306
MCIERR_GET_CD	307
MCIERR_SET_CD	308
MCIERR_SET_DRIVE	309
MCIERR_DEVICE_LENGTH	310
MCIERR_DEVICE_ORD_LENGTH	311
MCIERR_NO_INTEGER	312
MCIERR_WAVE_OUTPUTSINUSE	320
MCIERR_WAVE_SETOUTPUTINUSE	321
MCIERR_WAVE_INPUTSINUSE	322
MCIERR_WAVE_SETINPUTINUSE	323
MCIERR_WAVE_OUTPUTUNSPECIFIED	324
MCIERR_WAVE_INPUTUNSPECIFIED	325
MCIERR_WAVE_OUTPUTSUNSUITABLE	326
MCIERR_WAVE_SETOUTPUTUNSUITABLE	327
MCIERR_WAVE_INPUTSUNSUITABLE	328
MCIERR_WAVE_SETINPUTUNSUITABLE	329
MCIERR_SEQ_DIV_INCOMPATIBLE	336
MCIERR_SEQ_PORT_INUSE	337
MCIERR_SEQ_PORT_NONEXISTENT	338
MCIERR_SEQ_PORT_MAPNODEVICE	339
MCIERR_SEQ_PORT_MISCERROR	340
MCIERR_SEQ_TIMER	341
MCIERR_SEQ_PORTUNSPECIFIED	342
MCIERR_SEQ_NOMIDIPRESENT	343
MCIERR_NO_WINDOW	346
MCIERR_CREATEWINDOW	347
MCIERR_FILE_READ	348
MCIERR_FILE_WRITE	349
MCIERR_CUSTOM_DRIVER_BASE	512


Change Event (placeholder)


Click Event (placeholder)


DblClick Event (placeholder)


DragDrop Event (placeholder)


DragOver Event (placeholder)


KeyDown Event (placeholder)


KeyPress Event (placeholder)


KeyUp Event (placeholder)


MouseDown Event (placeholder)


MouseMove Event (placeholder)


MouseUp Event (placeholder)


OLECompleteDragEvent (placeholder)


OLEDragDrop Event (placeholder)


OLEDragOver Event (placeholder)


OLEGiveFeedback Event (placeholder)


OLESetData Event (placeholder)


OLEStartDrag Event (placeholder)


Refresh Method (placeholder)


OLEDrag Method (placeholder)


Appearance Property (placeholder)


BackColor Property (placeholder)


Caption Property (placeholder)


Enabled Property (placeholder)


Font Property (placeholder)


ForeColor Property (placeholder)


IntegralHeight Property (placeholder)


Locked Property (placeholder)


MouseIcon Property (placeholder)


MousePointer Property (placeholder)


OLEDragMode Property (placeholder)


OLEDropMode Property (placeholder)


SelLength Property (placeholder)


SelStart Property (placeholder)


SelText Property (placeholder)


Style Property (placeholder)


Text Property (placeholder)


Keyword Not Found

The keyword you've selected can't be found in Visual Basic Help. It's possible that:

•	The keyword is misspelled

•	You selected too much or too little text

•	You asked for help on a word that is not a valid Visual Basic keyword.

The easiest way to get help on a specific keyword is to position the insertion point anywhere within the keyword you want help on and press F1. You do not need to select the keyword. In fact, if you select only a portion of the keyword, or more than a single word, Help will not find what you're looking for.

To use the built-in Help search dialog box, press the Help Topics button on the toolbar.

One option to possibly find what you're looking for is to view the ReadMe file that comes with Visual Basic. This document contains information regarding last-minute changes, additions, and deletions that did not make it into the final documentation.


Left, Top Properties (Placeholder)


Height, Width Properties (Placeholder)


Tag Property (Placeholder)


ToolTipText Property (Placeholder)


Count Property (Placeholder)


Item Method (Placeholder)


Hwnd Property (Placeholder)


TabStop Property (Placeholder)


Visible Property (Placeholder)


Picture Property (placeholder)


Max, Min Properties (placeholder)


Add Method (placeholder)


Clear Method (placeholder)


Container Property (placeholder)


Controls Collection (placeholder)


Copies Property (placeholder)


DataBinding Object (placeholder)


DataBindings Collection (placeholder)


Filename Property (placeholder)


FontBold, FontItalic, FontStrikeThru Properties (placeholder)


FontName Property (placeholder)


FontSize Property (placeholder)


GetData Method (placeholder)


GetFormat Method (placeholder)


HelpFile Property (placeholder)


Item Property (placeholder)


Remove Method (placeholder)


SetData Method (placeholder)


Align Property (placeholder)


DragIcon Property (placeholder)


DragMode Property (placeholder)


HelpContextID Property (placeholder)


TabIndex Property (placeholder)


Alignment Constants (placeholder)


Border Property Constants (placeholder)


BorderStyle Constants (placeholder)


BorderStyle Property (ActiveX Controls) (placeholder)


Clear Method (ActiveX Controls) (placeholder)


Clipboard Object Constants (placeholder)


Color Constants (placeholder)


CommonDialog Control Constants (placeholder)


CommonDialog Error Constants (placeholder)


Control Constants (placeholder)


DataBindings Property (placeholder)


DDE Constants (placeholder)


Drag-and-Drop Constants (placeholder)


Drawing Constants (placeholder)


FetchVerbs Method (placeholder)


Form Constants (placeholder)


Graphics Constants (placeholder)


Grid Control Constants (placeholder)


Help Constants (placeholder)


HideSelection Property (ActiveX Controls) (placeholder)


HideSelection Property (placeholder)


Image Property (ActiveX Controls) (placeholder)


ImageList Property (ActiveX Controls) (placeholder)


Index Property (ActiveX Controls) (placeholder)


Index Property (placeholder)


Key Code Constants (placeholder)


Key Property (ActiveX Controls) (placeholder)


Menu Accelerator Constants (placeholder)


Menu Control Constants (placeholder)


Miscellaneous Constants (placeholder)


MousePointer Constants (placeholder)


OLE Container Control Constants (placeholder)


Picture Object Constants (placeholder)


Printer Object Constants (placeholder)


RasterOp Constants (placeholder)


Remove Method (ActiveX Controls) (placeholder)


ShowInTaskbar Property (placeholder)


ShowTips Property (ActiveX Controls) (placeholder)


ShowWhatsThis Method (placeholder)


Text Property (ActiveX Controls) (placeholder)


Value Property (ActiveX Controls) (placeholder)


Variant Type Constants (placeholder)


Visual Basic Constants (placeholder)


WhatsThisButton Property (placeholder)


WhatsThisHelp Property (placeholder)


WhatsThisHelpID Property (placeholder)


WhatsThisMode Method (placeholder)


Windows 95 Control Constants (placeholder)


ColIsVisible Property (placeholder)


ColPos Property (placeholder)


DataObject Object (placeholder)


DataObjectFiles Collection (placeholder)


DataSource Property (placeholder)


Drag Method (placeholder)


DrawMode Property (placeholder)


FixedAlignment Property (placeholder)


GotFocus Event (placeholder)


GridLineWidth Property (placeholder)


Index Property (Control Array) (placeholder)


LostFocus Event (placeholder)


Move Method (placeholder)


Name Property (placeholder)


Object Property (placeholder)


Parent Property (placeholder)


RowColChange Event (placeholder)


RowIsVisible Property (placeholder)


RowPos Property (placeholder)


SetFocus Method (placeholder)


ZOrder Method (placeholder)


Files Method (placeholder)


Connect Event (placeholder)


HScrollSmallChange, VScrollSmallChange Properties (placeholder)


MinHeight, MinWidth Properties (placeholder)


Property Pages Dialog Box (placeholder)


RemoteHost Property (placeholder)


RemotePort Property (placeholder)


ViewportHeight, ViewportLeft, ViewportTop, ViewportWidth Properties (placeholder)


Resync Method (Remote Data) (placeholder)


ContainedVBControls Collection (placeholder)


Member Object (placeholder)


Members Collection (placeholder)


VBComponentsEvents Object (placeholder)


VBProjectsEvents Object (placeholder)


Files Property (placeholder)


Alignment Property (placeholder)


AboutBox Method (placeholder)


Col, Row Properties (placeholder)


RowHeight Property (placeholder)


Scroll Event (placeholder)


ScrollBars Property (placeholder)


SelEndCol, SelStartCol, SelEndRow, SelStartRow Properties (placeholder)


ScrollBars Property (placeholder)


Appearance Property (ActiveX Controls) (placeholder)


BackColor, ForeColor Properties (ActiveX Controls) (placeholder)


BorderStyle Constants (ActiveX Controls) (placeholder)


Caption Property (ActiveX Controls) (placeholder)


Change Event (ActiveX Controls) (placeholder)


Clear Method (ActiveX Controls) (placeholder)


Click Event (ActiveX Controls) (placeholder)


Clipboard Object Constants (ActiveX Controls) (placeholder)


Count Property (ActiveX Controls) (placeholder)


DataObject Object (ActiveX Controls) (placeholder)


DataObjectFiles Collection (ActiveX Controls) (placeholder)


DataSource Property (ActiveX Controls) (placeholder)


DblClick Event (ActiveX Controls) (placeholder)


Drag-and-Drop Constants (ActiveX Controls) (placeholder)


Enabled Property (ActiveX Controls) (placeholder)


FetchVerbs Method (ActiveX Controls) (placeholder)


Files Method (ActiveX Controls) (placeholders)


Font Property (ActiveX Controls) (placeholder)


FontName Property (ActiveX Controls) (placeholder)


FontSize Property (ActiveX placeholder)


GetData Method (ActiveX Controls) (placeholder)


GetFormat Method (ActiveX Controls) (placeholder)


HideSelection Property (ActiveX Controls) (complaceholder)


hWnd Property (ActiveX Controls) (placeholder)


Item Method (ActiveX Controls) (placeholder)


Key Code Constants (ActiveX Controls) (placeholder)


Key Property (ActiveX Controls) (complaceholder)


KeyDown, KeyUp Events (ActiveX Controls) (placeholder)


KeyPress Event (ActiveX Controls) (placeholder)


Max, Min Properties (ActiveX Controls) (placeholder)


MouseDown, MouseUp Events (ActiveX Controls) (placeholder)


MouseIcon Property (ActiveX Controls) (placeholder)


MouseMove Event (ActiveX Controls) (placeholder)


MousePointer Constants (ActiveX Controls) (placeholder)


MousePointer Property (ActiveX Controls) (placeholder


OLECompleteDrag Event (ActiveX Controls) (placeholder)


OLEDrag Method (ActiveX Controls) (placeholder)


OLEDragDrop Event (ActiveX Controls) (placeholder)


OLEDragMode Property (ActiveX Controls) (placeholder)


OLEDragOver Event (ActiveX Controls) (placeholder)


OLEDropMode Property (ActiveX Controls) (placeholder)


OLEGiveFeedback Event (ActiveX Controls) (placeholder)


OLESetData Event (ActiveX Controls) (placeholder)


OLEStartDrag Event (ActiveX Controls) (placeholder)


Picture Property (ActiveX Controls) (placeholder)


Property Pages Dialog Box (ActiveX Controls) (placeholder)


RemoteHost Property (ActiveX Controls) (placeholder)


RemotePort Property (ActiveX Controls) (placeholder)


SelLength, SelStart, SelText Properties (ActiveX Controls) (placeholder)


SetData Method (ActiveX Controls) (placeholder)


ShowTips Property (ActiveX Controls) (complaceholder)


Text Property (ActiveX Controls) (complaceholder)


Value Property (ActiveX Controls) (complaceholder)


hDC Property (ActiveX Controls) (complaceholder)


Height, Width Properties (ActiveX Controls) (complaceholder)


Index Property (ActiveX Controls) (complaceholder)


Left, Top Properties (ActiveX Controls) (complaceholder)


Tag Property (ActiveX Controls) (complaceholder)


Visible Property (ActiveX Controls) (complaceholder)


Remove Method (ActiveX Controls) (complaceholder)


Object Property (ActiveX Controls) (placeholder)


Property Pages (ActiveX controls) (placeholder)


No fonts exist (Error 24574) (Common Dialog Control) (complaceholder)


Help Contents placeholder


BorderStyle Property (ActiveX Controls) (placeholder)


RightToLeft Property (ActiveX Controls) (placeholder)


Refresh Method (ActiveX Controls) (placeholder)