• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 205
  • Last Modified:

Change the system volume

Hi,

I need some example code (in C++ of course), that alters the systems volume (Windows).

Thanks in advance,
Rob.
0
InteractiveMind
Asked:
InteractiveMind
  • 5
  • 3
  • 2
  • +2
3 Solutions
 
Harisha M GCommented:
Hi InteractiveMind,
    #include <stdlib.h>

    main()
    {
        system("vol C: Vol_Name");
    }

should work :)

Bye
---
Harish
0
 
Harisha M GCommented:
InteractiveMind,
    system is a function that will run any DOS command...

    and to run that you should include <stdlib.h> or <dos.h>..

    Now, label is a command to change the volume label...

    So my code should have been

    #include <stdlib.h>

    main()
    {
        system("Label C: Vol_Name");
    }


    not ("vol c: vol_name"); .. my mistake
0
 
Harisha M GCommented:
InteractiveMind,
    That program is not working in Turbo C++ compiler.. however that works fine in Dev C++
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
AxterCommented:
For windows programming, you can use the SetVolumeLabel API function.
0
 
AxterCommented:
Example usage:
SetVolumeLabel( "C:\\", "AxtersDrive");
0
 
InteractiveMindAuthor Commented:
Oh. Woops.. Sorry guys, I hadn't worded that question too well; I need to change the systems Audio Volume.. :o\ lol - Sorry!

Any ideas? ^_^
Rob.
0
 
Harisha M GCommented:
auxSetVolume
0
 
Jaime OlivaresCommented:
0
 
Jaime OlivaresCommented:
0
 
Jaime OlivaresCommented:
0
 
jkrCommented:
Also see http://support.microsoft.com/default.aspx?scid=kb;en-us;139098 ("How to Use Wave Audio Volume Control APIs")
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 5
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now