Results 1 to 3 of 3

Thread: Is this too hard?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 1999
    Location
    Sunny Southern Weather
    Posts
    406

    Unhappy

    Is this too hard for you guys?

    I've loaded a wav file into a res file and I want to play
    it from my code.
    It's loaded into a res file as "WAV" type, and read from
    a .wav file.

    This is what I've done:

    eepSound = LoadResData(101, "WAV")
    sndPlaySound eepSound, SND_NODEFAULT Or SND_ASYNC

    However, I don't get any sound played.

    Anybody want to clue me in as to how to load a wav file into a res file and then play it?

    Thanks!

  2. #2
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892

    This should work.

    What's wrong with the [code] tag, by the way?

    If you loaded the wave file into the resource file correctly, then all your project is missing is this code:

    Dim btSound() As Byte

    btSound = LoadResData(101, "WAV")
    Call sndPlaySound(btSound(0), SND_NODEFAULT Or SND_ASYNC Or SND_MEMORY)


    Of course, you need to declare the function and the constants:

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

    Private Const SND_NODEFAULT = &H2
    Private Const SND_ASYNC = &H1
    Private Const SND_MEMORY = &H4


    This would go in the General Declarations part of the form.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 1999
    Location
    Sunny Southern Weather
    Posts
    406
    Thanks -

    I got almost the exact same code from Frans C and it worked well.

    -Wayneh

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