playing a sound using MMC, the second time no sound

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gobblegob
    New Member
    • Dec 2007
    • 133

    playing a sound using MMC, the second time no sound

    Hi guys,
    I am playing a sound using MMC on a form that pops up. Ok here is the problem it plays fine the first time but when the form loads the second time
    it plays no sound.


    [CODE=vb]Private Sub Form_Load()
    psSoundFile = "c:\alarm.w av"
    MMControl1.Devi ceType = "WAVEAUDIO"
    MMControl1.File Name = psSoundFile

    CmdStop.Enabled = True
    If MMControl1.Mode = mciModeNotOpen Then MMControl1.Comm and = "open"

    MMControl1.Comm and = "play"
    End Sub

    Private Sub StopWav()
    MMControl1.Comm and = "stop"
    MMControl1.Comm and = "close"
    MyMessage.Hide
    End Sub

    Private Sub CmdStop_Click()
    StopWav
    End Sub[/CODE]

    Thanks for any help guys
    Gobble.
    Last edited by debasisdas; Feb 22 '08, 06:02 AM. Reason: added code=vb tags
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    What do you mean by when the form loads the second time

    Comment

    • gobblegob
      New Member
      • Dec 2007
      • 133

      #3
      Originally posted by debasisdas
      What do you mean by when the form loads the second time
      ok i' explain better, i have form1 and form2.
      form2 is set to Show on a timer, and when it show's it plays a sound
      problem is when this is repeated it play's no sound

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Are you loading the form second time or just using Show and Hide methods ?

        Comment

        • gobblegob
          New Member
          • Dec 2007
          • 133

          #5
          Originally posted by debasisdas
          Are you loading the form second time or just using Show and Hide methods ?
          show method

          well i want to keep Form1 running all the time

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            Then try running the code in Form_Activate event not in Load event.

            Comment

            • gobblegob
              New Member
              • Dec 2007
              • 133

              #7
              Originally posted by debasisdas
              Then try running the code in Form_Activate event not in Load event.
              Awesome mate it worked , i never even new about that event

              Thanks heaps mate.

              Gobble.

              Comment

              Working...