Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    East Tennessee
    Posts
    179
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Playing WAV files (VB 40)

    With the help from people on this forum, I constructed the project below to play a series of WAV files.
    I made the project using VB4 on my Win 98se computer at home. They were intended to be used by a friend on his Win 2000 laptop. The program works fine on my 98 Computer and one with XP, (after I added the files VB40016.dll and OC25.dll ). It does not however work either of two different W2000 computers. It functions as far as the forms and other aspects, but will not generate any sounds.

    Can anybody advise me?

    Below are the major aspects of my project
    Win 8, Firefox 16.0.2, Thunderbird 15.0.2

  2. #2
    2 Star Lounger
    Join Date
    Nov 2001
    Location
    London, UK, England
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Playing WAV files (VB 40)

    The API declare may not be correct for this platform....I use the following in my projects.

    '// Sound API
    Public Const SND_SYNC = &H0
    Public Const SND_ASYNC = &H1
    Public Const SND_NODEFAULT = &H2
    Public Const SND_LOOP = &H8
    Public Const SND_NOSTOP = &H10

    Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
    (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

    ' // ************************************************** ****************************
    ' // SUB
    ' // PlayWAVFile(sFileName As String)
    ' //
    ' // PARAMETERS
    ' // sFileName - The name of the WAV file
    '
    ' // RETURN VALUE
    ' // None
    ' //
    ' // COMPONENTS USED
    ' // {Win32 API}
    ' //
    ' // NOTES
    ' // Plays a WAV file using the Win32 API
    ' // ************************************************** ****************************

    Public Sub PlayWAVFile(sFileName As String)

    Dim wFlags As String
    Dim vReturnValue As Variant
    Dim sPath As String

    On Error Resume Next
    wFlags = (SND_ASYNC Or SND_NODEFAULT)
    vReturnValue = sndPlaySound(sFileName, wFlags)

    End Sub

    Notice the DLL name has changed in the declaration. Perhaps you need to change this?

  3. #3
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    East Tennessee
    Posts
    179
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Playing WAV files (VB 40)

    Thanks for your efforts, but I haven't solved my problem yet.

    I changed the lib call to "Winmm.dll" as you used.

    Now the exe file wont run either on Win 98 or 2000. You didn't mention which OS you were working on.
    I checked on the Win 2000 machine and found the winmm.dll file and even made a copy of it into the directory where the other running files were, still NG.

    You have any other thoughts?
    Thanks again.
    Win 8, Firefox 16.0.2, Thunderbird 15.0.2

Posting Permissions

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