Thread: Mute application?

  1. #1
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768

    Mute application?

    Is there a way to mute all sound coming from my program?
    Even when I can't control the part of the program that creates that sound.


    Thank you.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    I'm guessing that you are refering to the beeps that windows makes in certain circumstances, like when you press enter in an edit box. You can make these sounds stop on a case by case basis, but there is no general API which can silence your application.

    As an example, to stop the beep that is given when enter is pressed, handle the WM_CHAR message, and return 0 when wParam is equal to VK_RETURN instead of calling the default procedure.

  3. #3
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    How about PlaySound() allong with SND_PURGE in the case WM_TIMER every 1 second.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Turn off your speakers or mute your sytem's sound in the control pannel.

  5. #5
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    *duhh*

  6. #6
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    I believe the only way to mute all sound is to turn off the speakers. Unless you can figure out how to mute the sound generated by the following ditty:

    Code:
    #include <stdio.h>
    int main(void)
    {
        printf("%c", '\a');
        return 0;
    }

  7. #7
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Here's how I would do it:
    Code:
    #include <stdio.h>
    int main(void)
    {
        //printf("%c", '\a');
        return 0;
    }
    Devil Panther >> You need to go into more detail regarding what you are looking for here.

  8. #8
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    The only way to turn off the speakers programaticly is to disable them by giving them a bad driver. (I think.)

  9. #9
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    Well here is the full story, I've used the cwebpage.dll described at this article: http://www.codeguru.com/Cpp/I-N/iepr...icle.php/c4379

    The the dll allows me to display a webpage inside my program, using an object.

    The application I'm writing displays a web based video camera inside my program's window.

    There is also a microphone connected to the same camera so I can hear just by displaying the camera with the dll.
    But since the program is meant to run in the background, the sound gets very annoying so I'm looking for a way to mute it on command, when every copy of the program is on it's own; In other words it has to be done locally.

    If there is no way to control the sound of my application, can I mute the system, just like I can mute using the "sound control" at the system tray?
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Cleanup of the application...
    By Petike in forum Windows Programming
    Replies: 1
    Last Post: 08-16-2008, 05:23 PM
  2. Problem with com application
    By amardon in forum C++ Programming
    Replies: 3
    Last Post: 10-06-2005, 05:50 AM
  3. MFC run application by clicking on file...
    By dug in forum Windows Programming
    Replies: 4
    Last Post: 12-02-2004, 04:33 AM
  4. Win application not very portable
    By swed in forum Windows Programming
    Replies: 5
    Last Post: 10-01-2001, 11:17 AM