Results 1 to 5 of 5

Thread: Hovering sounds...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    124

    Exclamation Hovering sounds...

    OK, now I have a label which I have assigned the MouseHover Declaration onto. What I want to achive, is to get a sound to play on the event and to stop playing on the MouseLeave event. The sound is electricity and I have an animated shocking title which I have placed the label over. So it would be good if it could loop on the event. The trouble is, I don't know how to get it to play. I put the wav into the Solution Explorer and I wonder if I could call it or something from there, but I don't know where to start.

    Thanks in adavance.

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Hovering sounds...

    VB Code:
    1. Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

    This API function will let you play a Wav file. Check this link for details of its parameters: http://www.mentalis.org/apilist/PlaySound.shtml
    I don't live here any more.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    124

    Unhappy Re: Hovering sounds...

    I can't get it to work, let alone understand it. Now I tried to see If I could use DirectX's sound thingy to play it for me. I think this would be overkill as all I need is to play one small wav, but right now, I'm willing to try anything. I tried this:

    VB Code:
    1. Imports Windows.DirectX

    But there is no DirectX under Windows name. I even tried this:

    VB Code:
    1. Imports System
    2. Imports DxVBLib
    3.  
    4. ' Then in a Public Class ---
    5.  
    6. Private use_dx As DirectX
    7. Private use_ds As DirectSound
    8.  
    9. ' There's the problem ---

    So 'DirectX' and 'DirectSound' is not "Defined" and won't work but it should take it from DxVBLib but that apparently doesn't exist either. What am I doing wrong? Oh and If anyone can offer an easier and better suggetion, please do, becuase this DirectX stuff is confusing, API is less coding too

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Hovering sounds...

    Well, first you have to have reference to the DirectX library before it can be imported. Once you set the reference, you should be able to have access to it's objects.

    Tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    124

    Re: Hovering sounds...

    How do I set the reference?

    (Btw, I'm going to scool now so I won't reply straight away)

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