1

With the following code you can change the volume on a Windows PC. But it changes the global volume.

I would like to change the slider value of Internet Explorer in the Mixer settings. can this be done?

Imports System.Runtime.InteropServices

Public Class Form1

 <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> Private Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
End Function

Const WM_APPCOMMAND As UInteger = &H319
Const APPCOMMAND_VOLUME_UP As UInteger = &HA
Const APPCOMMAND_VOLUME_DOWN As UInteger = &H9
Const APPCOMMAND_VOLUME_MUTE As UInteger = &H8

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    SendMessage(Me.Handle, WM_APPCOMMAND, &H30292, APPCOMMAND_VOLUME_UP * &H10000)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    SendMessage(Me.Handle, WM_APPCOMMAND, &H30292, APPCOMMAND_VOLUME_DOWN * &H10000)
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    SendMessage(Me.Handle, WM_APPCOMMAND, &H200EB0, APPCOMMAND_VOLUME_MUTE * &H10000)
End Sub

End Class
user2452250
  • 777
  • 2
  • 11
  • 26

1 Answers1

1

I found a similar answer somewhere else with a large C# example, you should be able to run this through a C# to vb.net converter and get what you're looking for (the person in this example is trying to control FireFox's volume, so essentially exactly what you're looking for).

Controling Volume Mixer

Community
  • 1
  • 1
Justin Packwood
  • 337
  • 2
  • 12