Hello.

I'd like to programatically toggle the system sound.
Right now, I change the device volume whenever I need to enable or disable
the sound, but I'm not very satisfied with this solution. I don't want to
prevent the user from changing the volume or the sound settings, I just want
to be able to toggle the system sound on and off when my application is
running.

Thanks in advance.

Re: Enable/Disable system sound. by Paul

Paul
Thu Mar 06 13:07:38 CST 2008

What's "the system sound"? It sounds to me like what you're already doing
is fine. If you set the system sound level to 'off' when your program
starts, that doesn't prevent the user from adjusting it manually again any
time during the run of your application. If you, when your application
exits, check the current setting and, if it's 'off', set it back to what it
was before your application started, that seems like a perfectly fine
solution.

Paul T.

"Fabio" <Fabio@discussions.microsoft.com> wrote in message
news:2994E351-0818-47B4-A58D-39FFCDF94AF2@microsoft.com...
> Hello.
>
> I'd like to programatically toggle the system sound.
> Right now, I change the device volume whenever I need to enable or disable
> the sound, but I'm not very satisfied with this solution. I don't want to
> prevent the user from changing the volume or the sound settings, I just
> want
> to be able to toggle the system sound on and off when my application is
> running.
>
> Thanks in advance.



Re: Enable/Disable system sound. by Fabio

Fabio
Thu Mar 06 13:33:05 CST 2008

System sound for me would be the whole device capability of playing sounds,
including songs, videos, notifications...
Right now I'm using the volume control, saving the initial volume and
setting it to 0 to mute the device, but the sound is still enabled.
What I'd like to do is toggle it on and off without changing the volume.
I know there is an on/off switch on the sound control displayed on the menu
bar, but I don't know how to change it programatically.


Fabio


"Paul G. Tobey [eMVP]" wrote:

> What's "the system sound"? It sounds to me like what you're already doing
> is fine. If you set the system sound level to 'off' when your program
> starts, that doesn't prevent the user from adjusting it manually again any
> time during the run of your application. If you, when your application
> exits, check the current setting and, if it's 'off', set it back to what it
> was before your application started, that seems like a perfectly fine
> solution.
>
> Paul T.
>
> "Fabio" <Fabio@discussions.microsoft.com> wrote in message
> news:2994E351-0818-47B4-A58D-39FFCDF94AF2@microsoft.com...
> > Hello.
> >
> > I'd like to programatically toggle the system sound.
> > Right now, I change the device volume whenever I need to enable or disable
> > the sound, but I'm not very satisfied with this solution. I don't want to
> > prevent the user from changing the volume or the sound settings, I just
> > want
> > to be able to toggle the system sound on and off when my application is
> > running.
> >
> > Thanks in advance.
>
>
>

Re: Enable/Disable system sound. by Scott

Scott
Thu Mar 06 16:16:48 CST 2008

=?Utf-8?B?RmFiaW8=?= <Fabio@discussions.microsoft.com> wrote:
>
>System sound for me would be the whole device capability of playing sounds,
>including songs, videos, notifications...
>Right now I'm using the volume control, saving the initial volume and
>setting it to 0 to mute the device, but the sound is still enabled.
>What I'd like to do is toggle it on and off without changing the volume.
>I know there is an on/off switch on the sound control displayed on the menu
>bar, but I don't know how to change it programatically.

You could do something like the following to disable all sound:

SNDFILEINFO sfi;
sfi.sstType = SND_SOUNDTYPE_NONE;
SndSetSound(SND_EVENT_ALL, &sfi, TRUE);

SND_SOUNDTYPE_ON will re-enable it.

--
--------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
Verbing weirds language.
-- Calvin in Calvin and Hobbes by Bill Watterson

Re: Enable/Disable system sound. by Fabio

Fabio
Fri Mar 07 07:59:02 CST 2008

Unfortunately this is only available since WM 5.
I'm looking for something for WM 3, or even better, WinCE 3.0


Fabio



"Scott Seligman" wrote:

> =?Utf-8?B?RmFiaW8=?= <Fabio@discussions.microsoft.com> wrote:
> >
> >System sound for me would be the whole device capability of playing sounds,
> >including songs, videos, notifications...
> >Right now I'm using the volume control, saving the initial volume and
> >setting it to 0 to mute the device, but the sound is still enabled.
> >What I'd like to do is toggle it on and off without changing the volume.
> >I know there is an on/off switch on the sound control displayed on the menu
> >bar, but I don't know how to change it programatically.
>
> You could do something like the following to disable all sound:
>
> SNDFILEINFO sfi;
> sfi.sstType = SND_SOUNDTYPE_NONE;
> SndSetSound(SND_EVENT_ALL, &sfi, TRUE);
>
> SND_SOUNDTYPE_ON will re-enable it.
>
> --
> --------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
> Verbing weirds language.
> -- Calvin in Calvin and Hobbes by Bill Watterson
>

Re: Enable/Disable system sound. by Scott

Scott
Fri Mar 07 10:08:20 CST 2008

=?Utf-8?B?RmFiaW8=?= <Fabio@discussions.microsoft.com> wrote:
>
>Unfortunately this is only available since WM 5.
>I'm looking for something for WM 3, or even better, WinCE 3.0

Ahh, I don't think there's any documented way pre WM5. I'd love to be
proven wrong.

--
--------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
To the rational mind, nothing is inexplicable; only unexplained.
-- The Doctor in Doctor Who:"The Robots of Death"