CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 1999
    Posts
    3

    Playing a WAV when mouse over a command button

    I would like to play a wav when the user moves over certain buttons. I tried to use the mousemove event on the buttons but this results in continuous play whenever the user moves anywhere within the button. I would like for the wav to be played just once. It's probably something easy but I've been banging my head away for the past 2 hours to no avail so any help would be appreciated. Thanks


  2. #2

    Re: Playing a WAV when mouse over a command button

    First, see http://www.freevbcode.com/ShowCode.Asp?ID=19 for code showing you how to play a .wav file.

    Second, the sound keeps playing because the mousemove event is fired each time you move your mouse over the control. You need to set a form level flag to true the first time the mouse move event is fired, and not play the .wav file when the flag is true. When the mouse moves out of the command button (i.e., any of the other form's elements, set the global flag back to false.

    Charlie Zimmerman


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

Featured