apollo2011 Posted May 6, 2003 Posted May 6, 2003 I have looked in the help guide in Visual Basic and Learn Visual Basic 4.0 in 21 Days and cannot find a way to set off code to play a .wav file besides the default BEEP.
blike Posted May 6, 2003 Posted May 6, 2003 Visual Basic 4.0 Welcome to the 90s!! (this goes in a module) Option Explicit Public Declare Function sndPlaySound Lib "winmm.dll" Alias _ "sndPlaySoundA" (ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Const SND_SYNC = &H0 Const SND_ASYNC = &H1 Const SND_NODEFAULT = &H2 Const SND_LOOP = &H8 Const SND_NOSTOP = &H10 'then, when you want to play a wav Dim sFlags As Long sFlags = SND_ASYNC Or SND_NODEFAULT sndPlaySound "FileName.Wav", sFlags from here
apollo2011 Posted May 9, 2003 Author Posted May 9, 2003 I tried the code but VB says that SND_ASYNC is an "Invalid Outside Procedure. If I delete it it says the same for SND_NODEFAULT. I copied and pasted the code right from the site you gave me.
blike Posted May 10, 2003 Posted May 10, 2003 "Dim sFlags As Long sFlags = SND_ASYNC Or SND_NODEFAULT sndPlaySound "FileName.Wav", sFlags" Where did you put that part? It shouldn't be in the declarations part of a module, it should be where you want the action performed..
apollo2011 Posted May 10, 2003 Author Posted May 10, 2003 I tried placing the code you last posted in a Command Button and it still doesn't work. When I run it it does nothing.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now