Jump to content

Recommended Posts

Posted

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.

Posted

Visual Basic 4.0 :o 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

Posted

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.

Posted

"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..

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.