Adding Sounds

skadoo323
07-19-2003, 12:55 PM
Hey all! Well this is program I am working on (i hate it attached as a zip file) but I want to add some sound to it. What it does it takes an inputted string from a user and encodes it when the user clicks encode and when the user clicks decode it decodes the string back. I just want to add some sounds through the program, either when the users click on a button or when a message box is popped up. Also how to add the systems beep? I think its something simple like beep, but I am not sure. Thanks is advnace.

Mad_Kitten
07-19-2003, 01:01 PM
for the beep take a look at this api
http://www.mentalis.org/apilist/Beep.shtml

for the sound:
http://www.allapi.net/apilist/mciSendString.shtml
or
http://www.mentalis.org/apilist/PlaySound.shtml

skadoo323
07-19-2003, 08:35 PM
i really didnt understand the web pages of those links given, I am still learning VB. is there any way someone can post some example with even just a regular system beep, or even a systems beep with a message box? also if you know how to incorporate a wav file? thanks

Squishy
07-19-2003, 08:39 PM
To get the default Windows beep, use Beep. I've never had to make the PC speaker beep, so I don't know the code.

Isaac
07-24-2003, 11:59 AM
Well, In XP the Beep API takes this format:

Beep Pitch, Duration
e.g
Beep 500, 200
will produce a moderately pitched sound for 200milliseconds.

Hope this helps.

gajit
07-24-2003, 12:27 PM
Well, In XP the Beep API takes this format:

Beep Pitch, Duration
e.g
Beep 500, 200
will produce a moderately pitched sound for 200milliseconds.

Hope this helps.

Here's the API call that I use (and a wrapper function to go with it). These play the specified .wav files.

Place in General Declarations:-

Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Public Const SND_SYNC = &H0 ' play synchronously (default)
Public Const SND_ASYNC = &H1
Public Const SND_NODEFAULT = &H2 ' silence not default, if sound not found
Public Const SND_LOOP = &H8
Public Const SND_NOSTOP = &H10

Public Function SoundBell()

Dim X As Long
X = sndPlaySound(App.Path & "\Sounds\error.wav", SND_ASYNC Or SND_NODEFAULT)

End Function


HTH,
Graham

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum