Results 1 to 7 of 7

Thread: WaveAduio Problem.....easy question....And yet i don't know :)

  1. #1

    Thread Starter
    Registered User struntz's Avatar
    Join Date
    Aug 1999
    Location
    Brockway,Pa,USA
    Posts
    199

    Post

    Hello,
    I'm having a problem i'm using VB 6 and i want it so when the user clicks on a commandbutton i want it to play a "waveAudio"
    this is the Code i have....and it only plays once....and when i click it again...it won't work ....nothing happens....
    []code[/]
    Private Sub Command1_Click()
    MMControl1.Notify = False
    MMControl1.Wait = True
    MMControl1.Shareable = False
    MMControl1.DeviceType = "WaveAudio"
    MMControl1.FileName = "C:\unzipped\dopewars\uhoh.wav"
    MMControl1.Command = "Open"
    MMControl1.Command = "Play"

    thats thats it! help if u can thanks for your time! bye!

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    You should close the sound if you want to open it again:

    Code:
    With MMControl1
        .Notify = False
        .Wait = True
        .Shareable = False
        .DeviceType = "WaveAudio"
        .FileName = "C:\unzipped\dopewars\uhoh.wav"
        .Command = "Open"
        .Command = "Play"
        .Command = "Close"
    End With
    ------------------

    Serge

    Senior Programmer Analyst
    [email protected]
    [email protected]
    ICQ#: 51055819

    [This message has been edited by Serge (edited 02-21-2000).]

  3. #3

    Thread Starter
    Registered User struntz's Avatar
    Join Date
    Aug 1999
    Location
    Brockway,Pa,USA
    Posts
    199

    Post

    when i add the mmcontrol1.Command = "CLose" it wont' even play the file....if i take it out....it plays the file once....and thats it! Do u know how to fix it?

  4. #4
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Post

    I don't know the answer to your problem (I've never used an MMControl), but you can play .wav files using the API function PlaySound. Visit this site for details on VB implemetation:
    http://www.vbapi.com/ref/p/playsound.html

    Also, to put code into your messages on this site, you almost had it right. Use...

    {code}
    Your
    code
    here
    {/code}

    except replace the curly braces with square brakets [] around the "code" and "/code" statements.

    ~seaweed

  5. #5
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Try this:
    Code:
        With MMControl1
            .Command = "Open"
            .Notify = True
            .Wait = True
            .Shareable = False
            .DeviceType = "WaveAudio"
            .FileName = "C:\winnt\media\office97\Whoosh.wav"
            .Command = "Play"
            .Command = "Close"
        End With
    ------------------

    Serge

    Senior Programmer Analyst
    [email protected]
    [email protected]
    ICQ#: 51055819

  6. #6

    Thread Starter
    Registered User struntz's Avatar
    Join Date
    Aug 1999
    Location
    Brockway,Pa,USA
    Posts
    199

    Post

    Alright thanks for the tip! and the information!

    ------------------
    Cory Sanchez
    Young Student
    ICQ#: 18640149



  7. #7

    Thread Starter
    Registered User struntz's Avatar
    Join Date
    Aug 1999
    Location
    Brockway,Pa,USA
    Posts
    199

    Post

    That one didn't work either....everyone i asked doesn't know how to make it so u can click on it and for it too keep playing ....they all said for me to use an API and i suck with them heh but i'll try

    ------------------
    Cory Sanchez
    Young Student
    ICQ#: 18640149



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