Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
How to play *.wav files using API Calls... ...
Author:
Marlon Durana
E-mail:
Click to e-mail author
Submitted:
1/4/2003
Version:
VB5
Compatibility:
VB5, VB6
Category:
Multimedia
Views:
14389
How to play *.wav files using API Calls...
Declarations:
Option Explicit Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long Private Const SND_ASYNC = &H1 Private Const SND_FILENAME = &H20000 Private Const SND_SYNC = &H0
Code:
' Functions Private Function SndPlay(ByVal filename As String, _ Optional ByVal options As Long = (SND_FILENAME Or _ SND_ASYNC)) As Long SndPlay = sndPlaySound(filename, options) End Function Private Function SndPlayEx(ByVal filename As String, _ Optional ByVal lmodule As Long = 0, Optional ByVal _ options As Long = (SND_FILENAME Or SND_ASYNC)) As Long SndPlayEx = PlaySound(filename, lmodule, options) End Function ' Sample usage ... ' Add two command buttons(Command1,Command2)in the form ' NOTE: change the filename to a valid WAV file.. Private Sub Command1_Click() SndPlay "c:\windows\media\tada.wav" End Sub Private Sub Command2_Click() SndPlayEx "c:\windows\media\tada.wav" End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement