View contents of this chapter

Error Handling

As the multimedia control performs its tasks, several notification and error checking condition are updated so that you can ensure smooth play of the device. The Notify property, if set to True, generates a Done event when next command is completed. The Wait property determines whether or not the Multimedia control waits for the next command to complete before returning control to the application.

You can handle errors encountered by the Multimedia control using the Error and ErrorMessage properties. You can test for an error condition after each command. For example, following the Open command, you check the value of the Error property to test for the existence of a CD drive. If the CD drive is not available, an error message is returned. For example:

If Form1.MMControl1.Error Then
   MsgBox "CD not working properly", vbCritical
End If

Play Sound Don't put an On Error GoTo statement at the top of the CD player's procedure because you then would not know exactly which multimedia control command triggered the error.


The following table lists several Mode values. The Mode property lets you test various states, or modes, of the multimedia control during the application's execution to determine what is currently taking place. This property is not available at design time and is read-only at run time.

Setting/Device mode Description
mciModeNotOpen Device is not open
mciModeStop Device is stopped
mciModePlay Device is playing
mciModeRecord Device is recording
mciModeSeek Device is seeking
mciModePause Device is paused
mciModeReady Device is ready

 



© Universal Teacher Publications        INDEX Previous Screen Next Screen