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
Making The Multimedia Control Wait
The Aesthetic Design Department is calling again. Users are flipping through your program too fast, not even waiting until the companys theme song finishes playing. Cant you do something about that?
You can set a multimedia controls Wait property to True (the default is False) if you want to make that control finish its current operation before continuing on to another. Note that this property is not available at design time.
Lets see an example; here, we open a file, C:\windows\media\canyon.mid, with a multimedia control, MMControl1, and set its Wait property to True:
Private Sub Form_Load()
MMControl1.FileName = "c:\windows\media\canyon.mid"
MMControl1.Command = "Open"
MMControl1.Wait = True
End Sub
Now when the user performs an operation with the control, such as playing the file, the control will wait until that operation is complete before letting the user select another operation.
Multimedia Without Multimedia Controls
The Testing Department is calling again. The multimedia control in your program takes up more than 100Kcant you use something else? Hmm, you say, Ill look into it.
If you just want to play sounds, you can use the Windows API function PlaySound. Using this built-in function instead of a multimedia control can save you a lot of memory space. Lets see an example. Here, well play the Windows c:\windows\media\Tada.wav file (which comes with Windows) using PlaySound. First, we declare the PlaySound function in a program; heres how you use PlaySound:
Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal _
lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) _
As Long
Declaring this function as a Private function lets us declare this in the (General) section of a form (without the Private keyword, wed have to declare this function in a module):
Private Declare Function PlaySound Lib "winmm.dll" Alias _
"PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, _
ByVal dwFlags As Long) As Long
Now we can call PlaySound directly when the user clicks a command button, Command1; here, we pass it a value of &H20000 to indicate that were reading the sound from a file and ignore the functions return value this way:
Private Sub Command1_Click()
retVal = PlaySound("c:\windows\media\Tada.wav", 0&, &H20000)
End Sub
Here are the flags you can use in the dwFlags parameter of the PlaySound function:
SND_SYNC&H0 (the default); play the sound synchronously
SND_ASYNC&H1; play the sound asynchronously
SND_NODEFAULT&H2; silence is not the default, if sound is not found
SND_MEMORY&H4; lpszName points to a memory file
SND_ALIAS&H10000; name is a win.ini [sounds] entry
SND_FILENAME&H20000; name is a file name
SND_RESOURCE&H40004; name is a resource name or atom
SND_ALIAS_ID&H110000; name is a win.ini [sounds] entry identifier
SND_ALIAS_START0; must be > 4096 to keep strings in same section of resource file
SND_LOOP&H8; loop the sound until next PlaySound
SND_NOSTOP&H10; dont stop any currently playing sound
SND_NOWAIT&H2000; dont wait if the driver is busy
And thats itnow were playing sounds without multimedia controls.
TIP: For lots more information on interfacing directly to the Windows API, see the next chapter.
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:
770 772770 772768 770mbdch20 772mbdch20 770769 7702SB 772Opis Paragon Hard Disk Manager 15 Suite 10 1 25 772 32bit & 64bit [ENG] [Full Ru Board]BEYERDYNAMIC DT 770 PROwięcej podobnych podstron