Results 1 to 4 of 4

Thread: play wav file

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2000
    Posts
    42
    how can i play wav file soound from vb.

  2. #2
    Guest
    Use the PlaySound API. Make a Form with a CommandButton and put the following code into it.

    Code:
    Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
    
    Private Sub Command1_Click()
    
        'Play the WAV
        PlaySound "C:\MyFile.wav", 0&, &H1
    
    End Sub

  3. #3
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    You can use the microsoft multimedia control

    OCX in your componets list
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    ' bas module code
    'API Function to play the sound 
    ' 
    Public Declare Function sndPlaySound Lib "winmm" Alias _ 
    "sndPlaySoundA" (ByVal lpszSoundName As String, _ 
    ByVal uFlags As Long) As Long 
    ' 
    ' play synchronously (default) 
    Public Const SND_SYNC = &H0 
    ' play asynchronously 
    Public Const SND_ASYNC = &H1 
    ' loop the sound until next 
    Public Const SND_LOOP = &H8 
    
    'form code
    
    Private Sub Command1_Click()
       Call sndPlaySound(ByVal "c:\yourfolder\yourfile.wav", SND_ASYNC) 
    End Sub 
    
    Private Sub Command2_Click() 
       Call sndPlaySound(0,0)  
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width