Results 1 to 15 of 15

Thread: How control to system sound volume

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2010
    Posts
    41

    Question How control to system sound volume

    I have control to system volume, how i can ?

    here :


  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: How control to system sound volume


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2010
    Posts
    41

    Re: How control to system sound volume

    Quote Originally Posted by akhileshbc View Post
    i using windows 7
    this like waveOutSetVolume api
    If this code works in which the program is opening voice of that program (not sound of system)

  4. #4
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: How control to system sound volume

    Try searching the forums: http://www.vbforums.com/search.php

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  5. #5
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: How control to system sound volume

    Quote Originally Posted by HarmDestroy View Post
    i using windows 7
    this like waveOutSetVolume api
    If this code works in which the program is opening voice of that program (not sound of system)
    I don't understand your statement. I ran that code while playing an existing .mpg on my HD. It sure enough controlled the volume at system level. What is needed is... another function (when you close your app) that resets the volume to whatever it was set at prior to calling the SetVolume function,
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  6. #6
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: How control to system sound volume

    I found this in the KPD Team API Guide and I'm posting it as is. This code reads the current system volume and also sets it. The code is raw and needs cleaning up as well as dressing up but that will leave something for you to do. A SliderControl (Vol Control) will be a nice mod. This code is also minimalist, which leaves plenty of room for you to grow it to your liking!

    Code:
    Option Explicit
    'Example submitted by Danjel Nyberg  KPD API Guide
    'It needs a textbox (Text1) and two command buttons (Command1, Command2)
    Private Declare Function waveOutSetVolume Lib "Winmm" (ByVal wDeviceID As Integer, ByVal dwVolume As Long) As Integer
    Private Declare Function waveOutGetVolume Lib "Winmm" (ByVal wDeviceID As Integer, dwVolume As Long) As Integer
    
    Private Sub Command1_Click()
        Dim a, i As Long
        Dim tmp As String
        a = waveOutGetVolume(0, i)
        tmp = "&h" & Right(Hex$(i), 4)
        Text1 = CLng(tmp)
    End Sub
    
    Private Sub Command2_Click()
        Dim a, i As Long
        Dim tmp, vol As String
        vol = Text1
        tmp = Right((Hex$(vol + 65536)), 4)
        vol = CLng("&H" & tmp & tmp)
        a = waveOutSetVolume(0, vol)
    End Sub
    Last edited by CDRIVE; Sep 5th, 2010 at 06:29 PM.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  7. #7
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: How control to system sound volume

    Sorry, I just got the drift of what you were desiring (No system level control). I guess your going to need a MMControl in your proj unless there's another way.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  8. #8

    Thread Starter
    Member
    Join Date
    Jun 2010
    Posts
    41

    Re: How control to system sound volume

    i upload picture, it is what i want

    for Windows 7

  9. #9
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: How control to system sound volume

    Quote Originally Posted by HarmDestroy View Post
    i upload picture, it is what i want

    for Windows 7
    Your subject title says System Volume. Your image seems to indicate same but it's not english, so I'm still not sure.
    Last edited by CDRIVE; Sep 5th, 2010 at 05:12 PM. Reason: Removed image to save space
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  10. #10
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: How control to system sound volume

    I found this.
    http://www.vbforums.com/showthread.p...ghlight=volume
    Check out post 11. Theres a download link there. I think it's using the MMControl.

    Edit: No it's not using a MMControl. In fact appears to be the same code as here.
    http://www.devx.com/vb2themax/Tip/19040

    I haven't used a MMControl in years and when I did it wasn't much. I was quite surprised to find no volume control on it when I checked it today!
    Last edited by CDRIVE; Sep 5th, 2010 at 10:35 PM.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  11. #11
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    Re: How control to system sound volume

    Quote Originally Posted by CDRIVE View Post
    I found this in the KPD Team API Guide and I'm posting it as is. This code reads the current system volume and also sets it. The code is raw and needs cleaning up as well as dressing up but that will leave something for you to do. A SliderControl (Vol Control) will be a nice mod. This code is also minimalist, which leaves plenty of room for you to grow it to your liking!

    Code:
    Option Explicit
    'Example submitted by Danjel Nyberg  KPD API Guide
    'It needs a textbox (Text1) and two command buttons (Command1, Command2)
    Private Declare Function waveOutSetVolume Lib "Winmm" (ByVal wDeviceID As Integer, ByVal dwVolume As Long) As Integer
    Private Declare Function waveOutGetVolume Lib "Winmm" (ByVal wDeviceID As Integer, dwVolume As Long) As Integer
    
    Private Sub Command1_Click()
        Dim a, i As Long
        Dim tmp As String
        a = waveOutGetVolume(0, i)
        tmp = "&h" & Right(Hex$(i), 4)
        Text1 = CLng(tmp)
    End Sub
    
    Private Sub Command2_Click()
        Dim a, i As Long
        Dim tmp, vol As String
        vol = Text1
        tmp = Right((Hex$(vol + 65536)), 4)
        vol = CLng("&H" & tmp & tmp)
        a = waveOutSetVolume(0, vol)
    End Sub
    I've tried it and it works, The only problem is that the code modifies the volume of the wave, not the general volume. How ca I fix that?

    Name:  windows_volume_contol.gif
Views: 1478
Size:  26.1 KB

  12. #12
    PowerPoster
    Join Date
    Aug 2011
    Location
    B.C., Canada
    Posts
    2,887

    Re: How control to system sound volume

    I found a project on planet source code and works on windows 7 here is the project... i tried to simplify it which didnt work i will have to look into it a bit more or maybe someone could simplify it... here is the project
    Attached Files Attached Files
    Last edited by Max187Boucher; Dec 8th, 2012 at 10:33 PM.

  13. #13
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    Re: How control to system sound volume

    I've also found a code in psc.com and it works for the Volume Control. I've tried the code posted just above this post and it doesn't works for me in Xp. Maybe the code needs to be modified in some way to adapt it because vb shows some errors while compiling.

  14. #14
    PowerPoster
    Join Date
    Aug 2011
    Location
    B.C., Canada
    Posts
    2,887

    Re: How control to system sound volume

    Did you load the .bas module that is missing but its actually in The folder you just need to add the file its the timer(something).bas
    It workes the first time for me then did not work and it worked again once i restarted... There is something with the api's thats being mixed or not working like it should on different OS i guess not too sure i dont know anything about those api openmixer etc....

  15. #15
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    Re: How control to system sound volume

    As you say, one of the *.bas files was missed and you need to add it in the project. If not, the program shows to you an error. So I loaded the bas file before running the program.

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