Results 1 to 7 of 7

Thread: Get Speakers Voulme

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 1999
    Posts
    89
    How can you get the speakers volume and get a notice when the volume changes. Thanks

  2. #2
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    I don't think you can get the Speaker volume, but you can get the system volume.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 1999
    Posts
    89
    Well how would you find out the System Volume, I am guessing that there is some API to do it.

  4. #4
    Guest
    Put the following in a Form with a Timer.
    Code:
    Private Declare Function waveOutSetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, ByVal dwVolume As Long) As Long
    Private Declare Function waveOutGetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, lpdwVolume As Long) As Long
    Dim OldVolume
    
    Function GetVolume() As Variant
        ' Get the volume
        Retval = waveOutGetVolume(1, volume)
        volume = volume And &HFFFF
        volume = Hex(volume)
        GetVolume = volume
    End Function
    
    Private Sub Form_Load()
        'Get the stsrting volume
        OldVolume = GetVolume()
    End Sub
    
    Private Sub Timer1_Timer()
        'Check if Volume has changed
        If GetVolume <> OldVolume Then
            MsgBox ("Volume has changed")
            'Set the current volume as the "OldVolume"
            OldVolume = GetVolume
        End If
    End Sub

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 1999
    Posts
    89
    I tried that code Megatron, but it didn't work for me, is that code suppose to trigger that msgbox if you change the
    Total Volume or Wave Volume. The program kept thinking my volume was 0 for some reason.

  6. #6
    Guest
    Change "1" to the your DeviceID in this line
    Retval = waveOutGetVolume(1, volume)

  7. #7
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516
    The volume control physically on the speakers cannot be accessed since it is local (eg it doesn't intercact with the computer)
    Courgettes.

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