If... Then

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • michels287
    New Member
    • Mar 2008
    • 20

    If... Then

    Hello ... I would greatly appreciate some help!

    I am new to Visual Basic and have been working hard on creating a simple application.

    I have two command buttons "Yes" and "No".

    I wish to play tones from my speakers and ask if the person listening can hear them.

    I have loaded the sndPlaySpound API into VB and can get sounds to play just great. However, how do I set it up so that when the user clicks "Yes I can hear that", the next wav tone (which is softer) would be played? This would have to repeat over and over until "No" is clicked.

    Thanks in advance for any suggestions!

    Chris
  • VBWheaties
    New Member
    • Feb 2008
    • 145

    #2
    Many approaches.

    Want a quick, dirty way?

    Create an invisible listbox. Load up your file paths of the waves in that listbox. And go to the next file in the invisible listbox when the user presses YES.

    Comment

    • michels287
      New Member
      • Mar 2008
      • 20

      #3
      Originally posted by VBWheaties
      Many approaches.

      Want a quick, dirty way?

      Create an invisible listbox. Load up your file paths of the waves in that listbox. And go to the next file in the invisible listbox when the user presses YES.
      Sounds like a good idea! Thanks. Do I still use my sndPlaySound commands in the listbox or is there an even easier way?

      So far... I load:

      Private Declare Function sndPlaySound Lib "WINMM.DLL" Alias _
      "sndPlaySou ndA" (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

      AND I have to type the following to get my first sound to play:

      SoundName$ = "C:\sound1. wav"
      wFlags% = SND_ASYNC Or SND_NODEFAULT
      x% = sndPlaySound(So undName$, wFlags%)

      Thanks a lot!

      I am really getting into VB.

      Chris

      Comment

      • michels287
        New Member
        • Mar 2008
        • 20

        #4
        I have my listbox set up!

        Can you recommend a "Yes" code that would get it to go to the next List option?

        Thanks again!!

        Comment

        Working...