Results 1 to 4 of 4

Thread: keydown with sound

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2004
    Location
    uk liverpool
    Posts
    238

    keydown with sound

    If i press the keydown key ,is it possible to have a sound when i do this if so,can you show me please .thanks paul

  2. #2
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780
    Heres a little example, its just basic tho.
    Notice the form has KeyPreview=true on it. Search for an explination if you need one, its been covered many times.
    Attached Files Attached Files

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2004
    Location
    uk liverpool
    Posts
    238

    works a treat but!

    i need to assign it it just one key it seems to play sound with all the keys ..the key i need in the down key.hope its not to much to ask thanks again.paul

  4. #4
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780
    Sorry, your first post said the keydown (which is actually an event in vb).

    All you have to do, is replace the keypress function with this one


    VB Code:
    1. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    2. If KeyCode = vbKeyDown Then
    3.     PlaySpeakerWave "C:\WINDOWS\Media\chimes.wav"
    4. End If
    5. End Sub

    Note, a keypress only gives you standard keys, while a keyup and keydown event gives you all keys.

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