Ask a questionAsk a question
 

AnswerSystem Volume Control

  • Wednesday, November 04, 2009 10:34 PMDarkhalodude Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    caN SOMONE guide me how to make my own system sound control in vb.net like a slider or % or anything!!! just a volume control!
    anyone?
    I like..... Understandable Answers 1 2 3 4 5 - - - - - Rate yourself And Have A Kitkat 5 5 5 5 5

Answers

  • Thursday, November 05, 2009 1:52 AMkaymaf Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    Try this

    <Runtime.InteropServices.DllImport("winmm.dll")> _
        Public Shared Function waveOutSetVolume(ByVal hwo As IntPtr, ByVal dwVolume As UInteger) As Integer
        End Function
    
    Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
             
            Dim NewVolume As Integer = ((UShort.MaxValue / 10) * TrackBar1.Value)
            ' Set the same volume for both the left and the right channels 
            Dim NewVolumeAllChannels As UInteger = ((CUInt(NewVolume) And &HFFFF) Or (CUInt(NewVolume) << 16))
            ' Set the volume 
            waveOutSetVolume(IntPtr.Zero, NewVolumeAllChannels)
            
        End Sub
    
    kaymaf
    If that what you want, take it. If not, ignored it and no complain
    • Marked As Answer byDarkhalodude Thursday, November 05, 2009 1:52 PM
    •  

All Replies

  • Wednesday, November 04, 2009 11:10 PMjwavila Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
  • Thursday, November 05, 2009 1:52 AMkaymaf Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    Try this

    <Runtime.InteropServices.DllImport("winmm.dll")> _
        Public Shared Function waveOutSetVolume(ByVal hwo As IntPtr, ByVal dwVolume As UInteger) As Integer
        End Function
    
    Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
             
            Dim NewVolume As Integer = ((UShort.MaxValue / 10) * TrackBar1.Value)
            ' Set the same volume for both the left and the right channels 
            Dim NewVolumeAllChannels As UInteger = ((CUInt(NewVolume) And &HFFFF) Or (CUInt(NewVolume) << 16))
            ' Set the volume 
            waveOutSetVolume(IntPtr.Zero, NewVolumeAllChannels)
            
        End Sub
    
    kaymaf
    If that what you want, take it. If not, ignored it and no complain
    • Marked As Answer byDarkhalodude Thursday, November 05, 2009 1:52 PM
    •