Visual Basic 6 Black Book:Multimedia
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
Visual Basic 6 Black Book
(Publisher: The Coriolis Group)
Author(s): Steven Holzner
ISBN: 1576102831
Publication Date: 08/01/98
function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
}
function bookMarkit()
{
var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();
}
Search this book:
Previous
Table of Contents
Next
Controlling The Multimedia Control From Code
The multimedia control displays buttons for the user to control whats going on with a particular multimedia device, but there are times when you dont want the control to be visible. For example, you may want to play sounds under program control using the multimedia control, in which case you dont want your multimedia control to be visible. In such a case, you should issue commands to the control directly using its Command property.
TIP: If you really just want to play sounds under program control, you can avoid the heavy drain on system resources by interfacing directly to Windows to play sounds instead of using a multimedia control. See Multimedia Without Multimedia Controls near the end of this chapter.
Every action that you can perform with a multimedia control you can perform with the Command property. Here are the possible commands that you set (as text strings) in the Command property:
OpenOpens a device using the MCI_OPEN command. Uses the DeviceType and/or FileName properties.
CloseCloses a device using the MCI_CLOSE command.
PlayPlays a device using the MCI_PLAY command. Can use the From and To properties if they are set.
PausePauses playing or recording using the MCI_PAUSE command. If executed while the device is paused, tries to resume playing or recording using the MCI_RESUME command.
StopStops playing or recording using the MCI_STOP command.
BackSteps backward using the MCI_STEP command. Uses the Frames property.
StepSteps forward using the MCI_STEP command. Uses the Frames property.
PrevGoes to the beginning of the current track using the Seek command. If executed within three seconds of the previous Prev command, it goes to the beginning of the previous track or to the beginning of the first track if at the first track.
NextGoes to the beginning of the next track (if at the last track, it goes to beginning of the last track) using the Seek command.
SeekIf not playing, seeks a position using the MCI_SEEK command. If playing, continues playing from the given position using the MCI_PLAY command. Can use the To property if set.
RecordRecords using the MCI_RECORD command. Can use the From and To properties if they are set.
EjectEjects media using the MCI_SET command.
SoundPlays a sound using the MCI_SOUND command. Uses the FileName property.
SaveSaves an open file using the MCI_SAVE command. Uses the FileName property.
Lets see an example. Here, we open and play the file C:\windows\media\ding.wav (which comes with Windows) when a form loads, using the Open and Play commands:
Private Sub Form_Load()
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.FileName = "C:\WINDOWS\MEDIA\DING.WAV"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
End Sub
If you dont want the multimedia control in this code, MMControl1, to be visible, set its Visible property to False.
Stopping And Pausing The Multimedia Control
The Testing Department is calling again. Beethovens Fifth Symphony is really fine, but does your program have to play it continuously? You explain that you like Beethoven. Fine, they say, add Stop and Pause buttons to your program.
Although the multimedia control has Stop and Pause buttons, those buttons wont be accessible if youre running the control from code and have made the control invisible. To stop the control, you can set its Command property to Stop this way:
Private Sub Stop_Click()
MMControl1.Command = "Stop"
End Sub
To pause the control, you set the Command property to Pause:
Private Sub Pause_Click()
MMControl1.Command = "Pause"
End Sub
Executing this line of code if the control is paused makes it try to resume again, but note that many devices dont support pause and resume. For example, if youre using the computers CD-ROM drive to play music and try to pause it, youll find that most drives stop and the multimedia controls Mode property (see the next topic in this chapter) will be set to mciModeStop, not mciModePause. If you try to resume the CD-ROM music with another Pause command, nothing will happenyou have to use the Play command to restart playback.
Previous
Table of Contents
Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.
Wyszukiwarka
Podobne podstrony:
SUZUKI GSXR 600 750Kartridże atramentowe Xerox M 750747 SHEET 2 tiled 8 5X11Agroxone Max 750 SLNUM 750 D900 12m747 ambdch20 747Magnat Maximus1 750 car amp747 749ZASOBNIK MULTI 750 0Cin Arrow 750 [DFM] MT60 89 1więcej podobnych podstron