Discussions related to Visual Prolog
User avatar
Gukalov
VIP Member
Posts: 68
Joined: 5 Oct 2011 15:16

How to mute/unmute computer from VIP programme?

Post by Gukalov »

Thanks in advance
User avatar
Thomas Linder Puls
VIP Member
Posts: 1468
Joined: 28 Feb 2000 0:01

Re: How to mute/unmute computer from VIP programme?

Post by Thomas Linder Puls »

Sorry, I don't understand what you are asking about?
Regards Thomas Linder Puls
PDC
User avatar
Gukalov
VIP Member
Posts: 68
Joined: 5 Oct 2011 15:16

Re: How to mute/unmute computer from VIP programme?

Post by Gukalov »

Computer plays music/movie or reads a book. Some event switchs sound off.
Like a mute button on TV remote control.
User avatar
Thomas Linder Puls
VIP Member
Posts: 1468
Joined: 28 Feb 2000 0:01

Re: How to mute/unmute computer from VIP programme?

Post by Thomas Linder Puls »

Sorry for not answering (before now).

I understand the problem now, but I am afraid that I don't have a solution for it.
Regards Thomas Linder Puls
PDC
User avatar
Gukalov
VIP Member
Posts: 68
Joined: 5 Oct 2011 15:16

Re: How to mute/unmute computer from VIP programme?

Post by Gukalov »

What's a pity!!!
It looks like Windows doesn't have a solution for it neither.
I use shutdown win command to switch computer off:

Code: Select all

shell_api::shellExecute(nullHandle, "open", "shutdown", @"/s /t 0 /f", "", windowsAPI::sw_hide)
There are win commands to switch monitor/keyboard/... off.
But I can not find anything about sysvolume.
It is possible to turn the media device off generally - this is too much.

So, nircmd.exe utilit is in use:

Code: Select all

class facts         soundOff : varM{boolean} := { = VarM :-                 VarM = varM::new(false),                 VarM:modified:addListener({ :-                         Par = string::format("mutesysvolume %u", if true = soundOff:value then 1 else 0 end if),                         try shell_api::shellExecute(nullHandle, "open", "nircmd.exe",  Par) catch _ do succeed() end try }) }().