Bernard
09-08-2000, 08:21 PM
I want to create a form on which are placed several command buttons. When the command button is pressed I want to be able to play a series of short wave files. Does anyone know how the coding for this is done. Appreciate any help offered.
Regards Bernard
johnjr
09-09-2000, 09:04 AM
here is some code to do this........
read the intro's
john
'**************************************
' Name: Easily Play a WAV File
' Description:This source code will easi
' ly allow you to play a WAV file from wit
' hin your Visual Basic application WITHOU
' T using an ActiveX Control. The two most
' amazing facts about this source code tha
' t amazed me were:
• The value For the "flag." I had absolutely no idea what to Do for the flag. But I took a good guess at it, and I got it!
• It will actually play the WAV file from the Visual Basic environment (you don't need to compile it to hear the sound).
' By: Terrance Henry Shaw
'
'
' Inputs:None
'
' Returns:None
'
'Assumes:1) Create one (1) CommandButton
' Control on the Form, and set the Name pr
' operty to "cmdSound" (minus the quotes).
'
'
'Side Effects:None
'
'Warranty:
'Code provided by Planet Source Code(tm)
' (http://www.Planet-Source-Code.com) 'as
' is', without warranties as to performanc
' e, fitness, merchantability,and any othe
' r warranty (whether expressed or implied
' ).
'Terms of Agreement:
'By using this source code, you agree to
' the following terms...
' 1) You may use this source code in per
' sonal projects and may compile it into a
' n .exe/.dll/.ocx and distribute it in bi
' nary format freely and with no charge.
' 2) You MAY NOT redistribute this sourc
' e code (for example to a web site) witho
' ut written permission from the original
' author.Failure to do so is a violation o
' f copyright laws.
' 3) You may link to this code from anot
' her website, provided it is not wrapped
' in a frame.
' 4) The author of this code may have re
' tained certain additional copyright righ
' ts.If so, this is indicated in the autho
' r's description.
'**************************************
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Sub PlayWav(Filename As String)
sndPlaySound (Filename), &H80
End Sub
Private Sub cmdSound_Click()
PlayWav "C:WINDOWSMediaChord.wav"
'Chord.wav is a file that comes along wi
' th both
'Windows 95 and 98 Operating Systems. If
' your
'system is missing this file, specify a
' different WAV.
End Sub
cbrewer
09-10-2000, 01:32 AM
Am I confused or can someone explain to me how you can put any kind of a copyright on a simple API call?
Chuck
anhmytran
09-10-2000, 01:53 AM
You can have copyright for a single word as long as you pay for it at the Law.
MeanWhile, people can get free source code here billion times larger than your copyrights-protected project.
If you doubt, search for the keyword in this web site.
AnhMy_Tran
Derek Stone
09-10-2000, 07:34 AM
Don't worry about the copyright.
It is just one way for people to make themselves feel good.
And I absolutely agree with what you are saying.
How else are you suppose to do it other than the above code?
Besides, that copyright is automatically added to every code that is submitted to planet-source-code.com, it is only there to protect those who have a legitimate reason to copyright something.
-cl